Class SingleFieldMapping

    • Field Detail

      • EXTENSION_CHECK_CONSTRAINT_VALUES

        public static final String EXTENSION_CHECK_CONSTRAINT_VALUES
        Metadata extension key that the column needs a CHECK constraint in the datastore on specific values. Set it to the valid values.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SingleFieldMapping

        public SingleFieldMapping()
    • Method Detail

      • initialize

        public void initialize​(org.datanucleus.metadata.AbstractMemberMetaData fmd,
                               Table table,
                               org.datanucleus.ClassLoaderResolver clr)
        Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.
        Overrides:
        initialize in class JavaTypeMapping
        Parameters:
        table - The datastore container storing this mapping (if any)
        clr - the ClassLoaderResolver
        fmd - FieldMetaData for the field to be mapped (if any)
      • prepareColumnMapping

        protected void prepareColumnMapping()
        Method to prepare a column mapping for use in the datastore. This creates the column in the table.
      • getDefaultLength

        public int getDefaultLength​(int index)
        Accessor for the default length for this type in the datastore (if applicable).
        Parameters:
        index - requested column index.
        Returns:
        Default length
      • getValidValues

        public Object[] getValidValues​(int index)
        Accessor for an array of valid values that this type can take. This can be used at the datastore side for restricting the values to be inserted.
        Parameters:
        index - requested column index.
        Returns:
        The valid values
      • getJavaTypeForColumnMapping

        public String getJavaTypeForColumnMapping​(int index)
        Accessor for the name of the java-type actually used when mapping the particular datastore field. This java-type must have an entry in the datastore mappings.
        Overrides:
        getJavaTypeForColumnMapping in class JavaTypeMapping
        Parameters:
        index - requested column index.
        Returns:
        the name of java-type for the requested column.
      • setBoolean

        public void setBoolean​(org.datanucleus.ExecutionContext ec,
                               PreparedStatement ps,
                               int[] exprIndex,
                               boolean value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setBoolean in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getBoolean

        public boolean getBoolean​(org.datanucleus.ExecutionContext ec,
                                  ResultSet resultSet,
                                  int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getBoolean in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setChar

        public void setChar​(org.datanucleus.ExecutionContext ec,
                            PreparedStatement ps,
                            int[] exprIndex,
                            char value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setChar in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getChar

        public char getChar​(org.datanucleus.ExecutionContext ec,
                            ResultSet resultSet,
                            int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getChar in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setByte

        public void setByte​(org.datanucleus.ExecutionContext ec,
                            PreparedStatement ps,
                            int[] exprIndex,
                            byte value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setByte in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getByte

        public byte getByte​(org.datanucleus.ExecutionContext ec,
                            ResultSet resultSet,
                            int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getByte in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setShort

        public void setShort​(org.datanucleus.ExecutionContext ec,
                             PreparedStatement ps,
                             int[] exprIndex,
                             short value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setShort in class JavaTypeMapping
        Parameters:
        ec - execution context
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getShort

        public short getShort​(org.datanucleus.ExecutionContext ec,
                              ResultSet resultSet,
                              int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getShort in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setInt

        public void setInt​(org.datanucleus.ExecutionContext ec,
                           PreparedStatement ps,
                           int[] exprIndex,
                           int value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setInt in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getInt

        public int getInt​(org.datanucleus.ExecutionContext ec,
                          ResultSet resultSet,
                          int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getInt in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setLong

        public void setLong​(org.datanucleus.ExecutionContext ec,
                            PreparedStatement ps,
                            int[] exprIndex,
                            long value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setLong in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getLong

        public long getLong​(org.datanucleus.ExecutionContext ec,
                            ResultSet resultSet,
                            int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getLong in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setFloat

        public void setFloat​(org.datanucleus.ExecutionContext ec,
                             PreparedStatement ps,
                             int[] exprIndex,
                             float value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setFloat in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getFloat

        public float getFloat​(org.datanucleus.ExecutionContext ec,
                              ResultSet resultSet,
                              int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getFloat in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setDouble

        public void setDouble​(org.datanucleus.ExecutionContext ec,
                              PreparedStatement ps,
                              int[] exprIndex,
                              double value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setDouble in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getDouble

        public double getDouble​(org.datanucleus.ExecutionContext ec,
                                ResultSet resultSet,
                                int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getDouble in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setString

        public void setString​(org.datanucleus.ExecutionContext ec,
                              PreparedStatement ps,
                              int[] exprIndex,
                              String value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setString in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getString

        public String getString​(org.datanucleus.ExecutionContext ec,
                                ResultSet resultSet,
                                int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getString in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value
      • setObject

        public void setObject​(org.datanucleus.ExecutionContext ec,
                              PreparedStatement ps,
                              int[] exprIndex,
                              Object value)
        Description copied from class: JavaTypeMapping
        Sets a value into datastoreStatement at position specified by exprIndex.
        Overrides:
        setObject in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        ps - PreparedStatement
        exprIndex - the position of the value in the statement
        value - the value
      • getObject

        public Object getObject​(org.datanucleus.ExecutionContext ec,
                                ResultSet resultSet,
                                int[] exprIndex)
        Description copied from class: JavaTypeMapping
        Obtains a value from datastoreResults at position specified by exprIndex.
        Overrides:
        getObject in class JavaTypeMapping
        Parameters:
        ec - ExecutionContext
        resultSet - ResultSet
        exprIndex - the position of the value in the result
        Returns:
        the value