Class FieldTypeDefinition
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition
-
- All Implemented Interfaces:
java.io.Serializable
public class FieldTypeDefinition extends java.lang.Object implements java.io.SerializableINTERNAL: 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 intdefaultSizeprotected intdefaultSubSizeprotected booleanisSizeAllowedprotected booleanisSizeRequiredprotected intmaxPrecisionprotected intmaxScaleprotected intminScaleprotected java.lang.Stringnameprotected booleanshouldAllowNullprotected java.lang.Stringtypesuffix
-
Constructor Summary
Constructors Constructor Description FieldTypeDefinition()FieldTypeDefinition(java.lang.String databaseTypeName)Return a new field type.FieldTypeDefinition(java.lang.String databaseTypeName, boolean allowsSize)Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition(java.lang.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(java.lang.String databaseTypeName, int defaultSize)Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition(java.lang.String databaseTypeName, int defaultSize, int defaultSubSize)Return a new field type with a required size defaulting to the defaultSize.FieldTypeDefinition(java.lang.String databaseTypeName, int defaultSize, java.lang.String aTypesuffix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDefaultSize()Return the default size for this type.intgetDefaultSubSize()Return the default sub-size for this type.intgetMaxPrecision()intgetMaxScale()intgetMinScale()java.lang.StringgetName()Return the name.java.lang.StringgetTypesuffix()Returns a type suffix (like unicode, byte or ascii) for maxdb create table stmtsbooleanisSizeAllowed()Return if this type can support a size specification.booleanisSizeRequired()Return if this type must have a size specification.voidsetDefaultSize(int defaultSize)Set the default size for this type.voidsetDefaultSubSize(int defaultSubSize)Set the default sub-size for this type.voidsetIsSizeAllowed(boolean aBoolean)Set if this type can support a size specification.voidsetIsSizeRequired(boolean aBoolean)Set if this type must have a size specification.FieldTypeDefinitionsetLimits(int maxPrecision, int minScale, int maxScale)Set the maximum precision and the minimum and maximum scale.voidsetMaxPrecision(int maximum)voidsetMaxScale(int maximum)voidsetMinScale(int minimum)voidsetName(java.lang.String name)Set the name.voidsetShouldAllowNull(boolean allowsNull)Set if this type is allowed to be null for this platformvoidsetSizeDisallowed()Set this type to not allow a size specification.voidsetSizeOptional()Set this type to optionally have a size specification.voidsetSizeRequired()Set this type to require to have a size specification.booleanshouldAllowNull()Return if this type is allowed to be null for this platformjava.lang.StringtoString()
-
-
-
Field Detail
-
name
protected java.lang.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 java.lang.String typesuffix
-
-
Constructor Detail
-
FieldTypeDefinition
public FieldTypeDefinition()
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.String databaseTypeName)
Return a new field type.- See Also:
#setName()
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.String databaseTypeName, int defaultSize)Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.String databaseTypeName, int defaultSize, int defaultSubSize)Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.String databaseTypeName, int defaultSize, java.lang.String aTypesuffix)
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.String databaseTypeName, boolean allowsSize)Return a new field type with a required size defaulting to the defaultSize.
-
FieldTypeDefinition
public FieldTypeDefinition(java.lang.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 java.lang.String getName()
Return the name.- Parameters:
name- can be any database primitive type name, this name will then be mapped to the Java primitive type, the datbase 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 java.lang.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(java.lang.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 datbase 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-