Class FieldTypeDefinition
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition
-
- All Implemented Interfaces:
Serializable
public class FieldTypeDefinition extends Object implements 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
defaultSize
protected int
defaultSubSize
protected boolean
isSizeAllowed
protected boolean
isSizeRequired
protected int
maxPrecision
protected int
maxScale
protected int
minScale
protected String
name
protected boolean
shouldAllowNull
protected String
typesuffix
-
Constructor Summary
Constructors Constructor Description FieldTypeDefinition()
FieldTypeDefinition(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDefaultSize()
Return the default size for this type.int
getDefaultSubSize()
Return the default sub-size for this type.int
getMaxPrecision()
int
getMaxScale()
int
getMinScale()
String
getName()
Return the name.String
getTypesuffix()
Returns a type suffix (like unicode, byte or ascii) for maxdb create table stmtsboolean
isSizeAllowed()
Return if this type can support a size specification.boolean
isSizeRequired()
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.FieldTypeDefinition
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
setName(String name)
Set the name.void
setShouldAllowNull(boolean allowsNull)
Set if this type is allowed to be null for this platformvoid
setSizeDisallowed()
Set this type to not allow a size specification.void
setSizeOptional()
Set this type to optionally have a size specification.void
setSizeRequired()
Set this type to require to have a size specification.boolean
shouldAllowNull()
Return if this type is allowed to be null for this platformString
toString()
-
-
-
Field Detail
-
name
protected String 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
protected String typesuffix
-
-
Constructor Detail
-
FieldTypeDefinition
public FieldTypeDefinition()
-
FieldTypeDefinition
public FieldTypeDefinition(String databaseTypeName)
Return a new field type.- See Also:
setName(String)
-
FieldTypeDefinition
public FieldTypeDefinition(String databaseTypeName, int defaultSize)
Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public FieldTypeDefinition(String databaseTypeName, int defaultSize, int defaultSubSize)
Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public FieldTypeDefinition(String databaseTypeName, int defaultSize, String aTypesuffix)
-
FieldTypeDefinition
public FieldTypeDefinition(String databaseTypeName, boolean allowsSize)
Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public 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.
-
-
Method Detail
-
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
public String 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:
DatabasePlatform
-
getTypesuffix
public String 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
public FieldTypeDefinition setLimits(int maxPrecision, int minScale, int maxScale)
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
public void setName(String name)
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:
DatabasePlatform
-
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.
-
-