org.jooq.Param Maven / Gradle / Ivy
/**
* Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com)
* All rights reserved.
*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
* - If you're using this work with Open Source databases, you may choose
* either ASL or jOOQ License.
* - If you're using this work with at least one commercial database, you must
* choose jOOQ License
*
* For more information, please visit http://www.jooq.org/licenses
*
* Apache Software License 2.0:
* -----------------------------------------------------------------------------
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* jOOQ License and Maintenance Agreement:
* -----------------------------------------------------------------------------
* Data Geekery grants the Customer the non-exclusive, timely limited and
* non-transferable license to install and use the Software under the terms of
* the jOOQ License and Maintenance Agreement.
*
* This library is distributed with a LIMITED WARRANTY. See the jOOQ License
* and Maintenance Agreement for more details: http://www.jooq.org/licensing
*/
package org.jooq;
import org.jooq.exception.DataTypeException;
import org.jooq.impl.DSL;
import org.jooq.tools.Convert;
/**
* A named parameter and/or bind value.
*
* @author Lukas Eder
* @see DSL#param(String, Object)
*/
public interface Param extends Field {
/**
* {@inheritDoc}
*
* The Param
's value for {@link #getName()} coincides with
* {@link #getParamName()}
*/
@Override
String getName();
/**
* The parameter name. This name is useful for two things:
*
* - Named parameters in frameworks that support them, such as Spring's
*
JdbcTemplate
* - Accessing the parameter from the {@link Query} API, with
* {@link Query#getParam(String)}, {@link Query#getParams()}
*
*/
String getParamName();
/**
* Get the parameter's underlying value. This returns null
if
* no value has been set yet.
*/
T getValue();
/**
* Set the parameter's underlying value. This is the same as
* {@link #setConverted(Object)}, but ensures generic type-safety.
*
* @see #setConverted(Object)
*/
void setValue(T value);
/**
* Sets a converted value, using this {@link Param}'s underlying
* {@link DataType}, obtained from {@link #getDataType()}
*
* @see DataType#convert(Object)
* @see Convert#convert(Object, Class)
* @throws DataTypeException If value
cannot be converted into
* this parameter's data type.
*/
void setConverted(Object value) throws DataTypeException;
/**
* A flag on the bind value to force it to be inlined in rendered SQL
*/
void setInline(boolean inline);
/**
* A flag on the bind value to force it to be inlined in rendered SQL
*/
boolean isInline();
}