Class EmptySqlParameterSource
- java.lang.Object
- org.springframework.jdbc.core.namedparam.EmptySqlParameterSource
- All Implemented Interfaces:
SqlParameterSource
public class EmptySqlParameterSource extends Object implements SqlParameterSource
A simple empty implementation of theSqlParameterSource
interface.- Since:
- 3.2.2
- Author:
- Juergen Hoeller
Field Summary
Fields Modifier and Type Field Description static EmptySqlParameterSource
INSTANCE
A shared instance ofEmptySqlParameterSource
.Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource
TYPE_UNKNOWN
Constructor Summary
Constructors Constructor Description EmptySqlParameterSource()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getParameterNames()
Enumerate all available parameter names if possible.int
getSqlType(String paramName)
Determine the SQL type for the specified named parameter.String
getTypeName(String paramName)
Determine the type name for the specified named parameter.Object
getValue(String paramName)
Return the parameter value for the requested named parameter.boolean
hasValue(String paramName)
Determine whether there is a value for the specified named parameter.
Field Detail
INSTANCE
public static final EmptySqlParameterSource INSTANCE
A shared instance ofEmptySqlParameterSource
.
Constructor Detail
EmptySqlParameterSource
public EmptySqlParameterSource()
Method Detail
hasValue
public boolean hasValue(String paramName)
Description copied from interface:SqlParameterSource
Determine whether there is a value for the specified named parameter.- Specified by:
hasValue
in interfaceSqlParameterSource
- Parameters:
paramName
- the name of the parameter- Returns:
- whether there is a value defined
getValue
@Nullable public Object getValue(String paramName) throws IllegalArgumentException
Description copied from interface:SqlParameterSource
Return the parameter value for the requested named parameter.- Specified by:
getValue
in interfaceSqlParameterSource
- Parameters:
paramName
- the name of the parameter- Returns:
- the value of the specified parameter
- Throws:
IllegalArgumentException
- if there is no value for the requested parameter
getSqlType
public int getSqlType(String paramName)
Description copied from interface:SqlParameterSource
Determine the SQL type for the specified named parameter.- Specified by:
getSqlType
in interfaceSqlParameterSource
- Parameters:
paramName
- the name of the parameter- Returns:
- the SQL type of the specified parameter, or
TYPE_UNKNOWN
if not known - See Also:
SqlParameterSource.TYPE_UNKNOWN
getTypeName
@Nullable public String getTypeName(String paramName)
Description copied from interface:SqlParameterSource
Determine the type name for the specified named parameter.- Specified by:
getTypeName
in interfaceSqlParameterSource
- Parameters:
paramName
- the name of the parameter- Returns:
- the type name of the specified parameter, or
null
if not known
getParameterNames
@Nullable public String[] getParameterNames()
Description copied from interface:SqlParameterSource
Enumerate all available parameter names if possible.This is an optional operation, primarily for use with
SimpleJdbcInsert
andSimpleJdbcCall
.- Specified by:
getParameterNames
in interfaceSqlParameterSource
- Returns:
- the array of parameter names, or
null
if not determinable - See Also:
SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(org.springframework.jdbc.core.namedparam.SqlParameterSource)