org.springframework.jdbc.core.namedparam

Class MapSqlParameterSource

    • Constructor Summary

      Constructors 
      Constructor and Description
      MapSqlParameterSource()
      Create an empty MapSqlParameterSource, with values to be added via addValue.
      MapSqlParameterSource(java.util.Map<java.lang.String,?> values)
      Create a new MapSqlParameterSource based on a Map.
      MapSqlParameterSource(java.lang.String paramName, java.lang.Object value)
      Create a new MapSqlParameterSource, with one value comprised of the supplied arguments.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      MapSqlParameterSource addValue(java.lang.String paramName, java.lang.Object value)
      Add a parameter to this parameter source.
      MapSqlParameterSource addValue(java.lang.String paramName, java.lang.Object value, int sqlType)
      Add a parameter to this parameter source.
      MapSqlParameterSource addValue(java.lang.String paramName, java.lang.Object value, int sqlType, java.lang.String typeName)
      Add a parameter to this parameter source.
      MapSqlParameterSource addValues(java.util.Map<java.lang.String,?> values)
      Add a Map of parameters to this parameter source.
      java.lang.String[] getParameterNames()
      Extract all available parameter names if possible.
      java.lang.Object getValue(java.lang.String paramName)
      Return the parameter value for the requested named parameter.
      java.util.Map<java.lang.String,java.lang.Object> getValues()
      Expose the current parameter values as read-only Map.
      boolean hasValue(java.lang.String paramName)
      Determine whether there is a value for the specified named parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapSqlParameterSource

        public MapSqlParameterSource()
        Create an empty MapSqlParameterSource, with values to be added via addValue.
        See Also:
        addValue(String, Object)
      • MapSqlParameterSource

        public MapSqlParameterSource(java.lang.String paramName,
                                     @Nullable
                                     java.lang.Object value)
        Create a new MapSqlParameterSource, with one value comprised of the supplied arguments.
        Parameters:
        paramName - the name of the parameter
        value - the value of the parameter
        See Also:
        addValue(String, Object)
      • MapSqlParameterSource

        public MapSqlParameterSource(@Nullable
                                     java.util.Map<java.lang.String,?> values)
        Create a new MapSqlParameterSource based on a Map.
        Parameters:
        values - a Map holding existing parameter values (can be null)
    • Method Detail

      • addValue

        public MapSqlParameterSource addValue(java.lang.String paramName,
                                              @Nullable
                                              java.lang.Object value)
        Add a parameter to this parameter source.
        Parameters:
        paramName - the name of the parameter
        value - the value of the parameter
        Returns:
        a reference to this parameter source, so it's possible to chain several calls together
      • addValue

        public MapSqlParameterSource addValue(java.lang.String paramName,
                                              @Nullable
                                              java.lang.Object value,
                                              int sqlType)
        Add a parameter to this parameter source.
        Parameters:
        paramName - the name of the parameter
        value - the value of the parameter
        sqlType - the SQL type of the parameter
        Returns:
        a reference to this parameter source, so it's possible to chain several calls together
      • addValue

        public MapSqlParameterSource addValue(java.lang.String paramName,
                                              @Nullable
                                              java.lang.Object value,
                                              int sqlType,
                                              java.lang.String typeName)
        Add a parameter to this parameter source.
        Parameters:
        paramName - the name of the parameter
        value - the value of the parameter
        sqlType - the SQL type of the parameter
        typeName - the type name of the parameter
        Returns:
        a reference to this parameter source, so it's possible to chain several calls together
      • addValues

        public MapSqlParameterSource addValues(@Nullable
                                               java.util.Map<java.lang.String,?> values)
        Add a Map of parameters to this parameter source.
        Parameters:
        values - a Map holding existing parameter values (can be null)
        Returns:
        a reference to this parameter source, so it's possible to chain several calls together
      • getValues

        public java.util.Map<java.lang.String,java.lang.Object> getValues()
        Expose the current parameter values as read-only Map.
      • hasValue

        public boolean hasValue(java.lang.String paramName)
        Description copied from interface: SqlParameterSource
        Determine whether there is a value for the specified named parameter.
        Parameters:
        paramName - the name of the parameter
        Returns:
        whether there is a value defined
      • getValue

        @Nullable
        public java.lang.Object getValue(java.lang.String paramName)
        Description copied from interface: SqlParameterSource
        Return the parameter value for the requested named parameter.
        Parameters:
        paramName - the name of the parameter
        Returns:
        the value of the specified parameter