Module org.eclipse.persistence.core
Class FieldTypeDefinition
java.lang.Object
org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition
- All Implemented Interfaces:
Serializable
INTERNAL:
Purpose: Define a database platform specific definition for a platform independent Java class type.
This is used for the field creation within a table creation statement.
Responsibilities:
- Store a default size and know if the size option is required or optional.
- Store the name of the real database type.
- Maintain maximum precision and optionall min & max Scale.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFieldTypeDefinition
(String databaseTypeName) Return a new field type.FieldTypeDefinition
(String databaseTypeName, boolean allowsSize) Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition
(String databaseTypeName, boolean allowsSize, boolean allowsNull) Return a new field type with a required size defaulting to the defaultSize and shouldAllowNull set to allowsNull.FieldTypeDefinition
(String databaseTypeName, int defaultSize) Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition
(String databaseTypeName, int defaultSize, int defaultSubSize) Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition
(String databaseTypeName, int defaultSize, String aTypesuffix) -
Method Summary
Modifier and TypeMethodDescriptionint
Return the default size for this type.int
Return the default sub-size for this type.int
int
int
getName()
Return the name.Returns a type suffix (like unicode, byte or ascii) for maxdb create table stmtsboolean
Return if this type can support a size specification.boolean
Return if this type must have a size specification.void
setDefaultSize
(int defaultSize) Set the default size for this type.void
setDefaultSubSize
(int defaultSubSize) Set the default sub-size for this type.void
setIsSizeAllowed
(boolean aBoolean) Set if this type can support a size specification.void
setIsSizeRequired
(boolean aBoolean) Set if this type must have a size specification.setLimits
(int maxPrecision, int minScale, int maxScale) Set the maximum precision and the minimum and maximum scale.void
setMaxPrecision
(int maximum) void
setMaxScale
(int maximum) void
setMinScale
(int minimum) void
Set the name.void
setShouldAllowNull
(boolean allowsNull) Set if this type is allowed to be null for this platformvoid
Set this type to not allow a size specification.void
Set this type to optionally have a size specification.void
Set this type to require to have a size specification.boolean
Return if this type is allowed to be null for this platformtoString()
-
Field Details
-
name
-
defaultSize
protected int defaultSize -
defaultSubSize
protected int defaultSubSize -
isSizeAllowed
protected boolean isSizeAllowed -
isSizeRequired
protected boolean isSizeRequired -
maxPrecision
protected int maxPrecision -
minScale
protected int minScale -
maxScale
protected int maxScale -
shouldAllowNull
protected boolean shouldAllowNull -
typesuffix
-
-
Constructor Details
-
FieldTypeDefinition
public FieldTypeDefinition() -
FieldTypeDefinition
Return a new field type.- See Also:
-
FieldTypeDefinition
Return a new field type with a required size defaulting to the defaultSize. -
FieldTypeDefinition
Return a new field type with a required size defaulting to the defaultSize. -
FieldTypeDefinition
-
FieldTypeDefinition
Return a new field type with a required size defaulting to the defaultSize. -
FieldTypeDefinition
Return a new field type with a required size defaulting to the defaultSize and shouldAllowNull set to allowsNull.
-
-
Method Details
-
getDefaultSize
public int getDefaultSize()Return the default size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one. -
getDefaultSubSize
public int getDefaultSubSize()Return the default sub-size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one. -
getMaxPrecision
public int getMaxPrecision() -
getMaxScale
public int getMaxScale() -
getMinScale
public int getMinScale() -
getName
Return the name. Can be any database primitive type name, this name will then be mapped to the Java primitive type, the database type varies by platform and the mappings can be found in the subclasses of DatabasePlatform. these Java names and their ODBC mappings include; - Integer -> SQL_INT - Float -> SQL_FLOAT - Double -> SQL_DOUBLE - Long -> SQL_LONG - Short -> SQL_INT - BigDecimal -> SQL_NUMERIC - BigInteger -> SQL_NUMERIC - String -> SQL_VARCHAR - Array -> BLOB - Character[] -> SQL_CHAR - Boolean -> SQL_BOOL - Text -> CLOB - Date -> SQL_DATE - Time -> SQL_TIME - Timestamp -> SQL_TIMESTAMP- See Also:
-
getTypesuffix
Returns a type suffix (like unicode, byte or ascii) for maxdb create table stmts -
isSizeAllowed
public boolean isSizeAllowed()Return if this type can support a size specification. -
isSizeRequired
public boolean isSizeRequired()Return if this type must have a size specification. -
shouldAllowNull
public boolean shouldAllowNull()Return if this type is allowed to be null for this platform -
setDefaultSize
public void setDefaultSize(int defaultSize) Set the default size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one. -
setDefaultSubSize
public void setDefaultSubSize(int defaultSubSize) Set the default sub-size for this type. This default size will be used if the database requires specification of a size, and the table definition did not provide one. -
setIsSizeAllowed
public void setIsSizeAllowed(boolean aBoolean) Set if this type can support a size specification. -
setIsSizeRequired
public void setIsSizeRequired(boolean aBoolean) Set if this type must have a size specification. -
setShouldAllowNull
public void setShouldAllowNull(boolean allowsNull) Set if this type is allowed to be null for this platform -
setLimits
Set the maximum precision and the minimum and maximum scale.- Returns:
- this Allowing the method to be invoked inline with constructor
-
setMaxPrecision
public void setMaxPrecision(int maximum) -
setMaxScale
public void setMaxScale(int maximum) -
setMinScale
public void setMinScale(int minimum) -
setName
Set the name.- Parameters:
name
- can be any database primitive type name, this name will then be mapped to the Java primitive type, the database type varies by platform and the mappings can be found in the subclasses of DatabasePlatform. these Java names and their ODBC mappings include; - Integer -> SQL_INT - Float -> SQL_FLOAT - Double -> SQL_DOUBLE - Long -> SQL_LONG - Short -> SQL_INT - BigDecimal -> SQL_NUMERIC - BigInteger -> SQL_NUMERIC - String -> SQL_VARCHAR - Array -> BLOB - Character[] -> SQL_CHAR - Boolean -> SQL_BOOL - Text -> CLOB - Date -> SQL_DATE - Time -> SQL_TIME - Timestamp -> SQL_TIMESTAMP- See Also:
-
setSizeDisallowed
public void setSizeDisallowed()Set this type to not allow a size specification. -
setSizeOptional
public void setSizeOptional()Set this type to optionally have a size specification. -
setSizeRequired
public void setSizeRequired()Set this type to require to have a size specification. -
toString
-