org.datanucleus.store.mapped.mapping
Class AbstractDatastoreMapping

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.AbstractDatastoreMapping
All Implemented Interfaces:
DatastoreMapping

public abstract class AbstractDatastoreMapping
extends java.lang.Object
implements DatastoreMapping

Abstract base for datastore mappings.


Field Summary
protected static Localiser LOCALISER
           
protected  JavaTypeMapping mapping
          Mapping of the Java type.
 
Constructor Summary
AbstractDatastoreMapping(JavaTypeMapping mapping)
           
 
Method Summary
protected  java.lang.String failureMessage(java.lang.String method)
          Utility to output any error message.
 boolean getBoolean(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 byte getByte(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 char getChar(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 double getDouble(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 float getFloat(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 int getInt(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 JavaTypeMapping getJavaTypeMapping()
          Accessor for the java type mapping
 long getLong(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 java.lang.Object getObject(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 short getShort(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 java.lang.String getString(java.lang.Object resultSet, int exprIndex)
          Obtains a value from resultSet at position specified by exprIndex.
 boolean isBitBased()
          Accessor for whether the mapping is bit-based.
 boolean isBooleanBased()
          Accessor for whether the mapping is boolean-based.
 boolean isDecimalBased()
          Accessor for whether the mapping is decimal-based.
 boolean isIntegerBased()
          Accessor for whether the mapping is integer-based.
 boolean isStringBased()
          Accessor for whether the mapping is string-based.
 void setBoolean(java.lang.Object preparedStatement, int exprIndex, boolean value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setByte(java.lang.Object preparedStatement, int exprIndex, byte value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setChar(java.lang.Object preparedStatement, int exprIndex, char value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setDouble(java.lang.Object preparedStatement, int exprIndex, double value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setFloat(java.lang.Object preparedStatement, int exprIndex, float value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setInt(java.lang.Object preparedStatement, int exprIndex, int value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setLong(java.lang.Object preparedStatement, int exprIndex, long value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setObject(java.lang.Object preparedStatement, int exprIndex, java.lang.Object value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setShort(java.lang.Object preparedStatement, int exprIndex, short value)
          Sets a value into preparedStatement at position specified by paramIndex.
 void setString(java.lang.Object preparedStatement, int exprIndex, java.lang.String value)
          Sets a value into preparedStatement at position specified by paramIndex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.mapped.mapping.DatastoreMapping
getDatastoreField, isNullable
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER

mapping

protected final JavaTypeMapping mapping
Mapping of the Java type.

Constructor Detail

AbstractDatastoreMapping

public AbstractDatastoreMapping(JavaTypeMapping mapping)
Method Detail

getJavaTypeMapping

public JavaTypeMapping getJavaTypeMapping()
Accessor for the java type mapping

Specified by:
getJavaTypeMapping in interface DatastoreMapping
Returns:
The java type mapping used

setBoolean

public void setBoolean(java.lang.Object preparedStatement,
                       int exprIndex,
                       boolean value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setBoolean in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getBoolean

public boolean getBoolean(java.lang.Object resultSet,
                          int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getBoolean in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setChar

public void setChar(java.lang.Object preparedStatement,
                    int exprIndex,
                    char value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setChar in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getChar

public char getChar(java.lang.Object resultSet,
                    int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getChar in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setByte

public void setByte(java.lang.Object preparedStatement,
                    int exprIndex,
                    byte value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setByte in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getByte

public byte getByte(java.lang.Object resultSet,
                    int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getByte in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setShort

public void setShort(java.lang.Object preparedStatement,
                     int exprIndex,
                     short value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setShort in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getShort

public short getShort(java.lang.Object resultSet,
                      int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getShort in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setInt

public void setInt(java.lang.Object preparedStatement,
                   int exprIndex,
                   int value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setInt in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getInt

public int getInt(java.lang.Object resultSet,
                  int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getInt in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setLong

public void setLong(java.lang.Object preparedStatement,
                    int exprIndex,
                    long value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setLong in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getLong

public long getLong(java.lang.Object resultSet,
                    int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getLong in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setFloat

public void setFloat(java.lang.Object preparedStatement,
                     int exprIndex,
                     float value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setFloat in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getFloat

public float getFloat(java.lang.Object resultSet,
                      int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getFloat in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setDouble

public void setDouble(java.lang.Object preparedStatement,
                      int exprIndex,
                      double value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setDouble in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getDouble

public double getDouble(java.lang.Object resultSet,
                        int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getDouble in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setString

public void setString(java.lang.Object preparedStatement,
                      int exprIndex,
                      java.lang.String value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setString in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getString

public java.lang.String getString(java.lang.Object resultSet,
                                  int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getString in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setObject

public void setObject(java.lang.Object preparedStatement,
                      int exprIndex,
                      java.lang.Object value)
Description copied from interface: DatastoreMapping
Sets a value into preparedStatement at position specified by paramIndex.

Specified by:
setObject in interface DatastoreMapping
Parameters:
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getObject

public java.lang.Object getObject(java.lang.Object resultSet,
                                  int exprIndex)
Description copied from interface: DatastoreMapping
Obtains a value from resultSet at position specified by exprIndex.

Specified by:
getObject in interface DatastoreMapping
Parameters:
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

isDecimalBased

public boolean isDecimalBased()
Accessor for whether the mapping is decimal-based.

Specified by:
isDecimalBased in interface DatastoreMapping
Returns:
Whether the mapping is decimal based

isIntegerBased

public boolean isIntegerBased()
Accessor for whether the mapping is integer-based.

Specified by:
isIntegerBased in interface DatastoreMapping
Returns:
Whether the mapping is integer based

isStringBased

public boolean isStringBased()
Accessor for whether the mapping is string-based.

Specified by:
isStringBased in interface DatastoreMapping
Returns:
Whether the mapping is string based

isBitBased

public boolean isBitBased()
Accessor for whether the mapping is bit-based.

Specified by:
isBitBased in interface DatastoreMapping
Returns:
Whether the mapping is bit based

isBooleanBased

public boolean isBooleanBased()
Accessor for whether the mapping is boolean-based.

Specified by:
isBooleanBased in interface DatastoreMapping
Returns:
Whether the mapping is boolean based

failureMessage

protected java.lang.String failureMessage(java.lang.String method)
Utility to output any error message.

Parameters:
method - The method that failed.
Returns:
The localised failure message


Copyright © 2010. All Rights Reserved.