public class FieldTypeDefinition extends Object implements Serializable
Responsibilities:
Modifier and Type | Field and 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 |
Constructor and 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.
|
Modifier and Type | Method and 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.
|
boolean |
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 platform
|
void |
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 platform
|
String |
toString() |
protected String name
protected int defaultSize
protected int defaultSubSize
protected boolean isSizeAllowed
protected boolean isSizeRequired
protected int maxPrecision
protected int minScale
protected int maxScale
protected boolean shouldAllowNull
public FieldTypeDefinition()
public FieldTypeDefinition(String databaseTypeName)
#setName()
public FieldTypeDefinition(String databaseTypeName, int defaultSize)
public FieldTypeDefinition(String databaseTypeName, int defaultSize, int defaultSubSize)
public FieldTypeDefinition(String databaseTypeName, boolean allowsSize)
public FieldTypeDefinition(String databaseTypeName, boolean allowsSize, boolean allowsNull)
public int getDefaultSize()
public int getDefaultSubSize()
public int getMaxPrecision()
public int getMaxScale()
public int getMinScale()
public String getName()
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_TIMESTAMPDatabasePlatform
public boolean isSizeAllowed()
public boolean isSizeRequired()
public boolean shouldAllowNull()
public void setDefaultSize(int defaultSize)
public void setDefaultSubSize(int defaultSubSize)
public void setIsSizeAllowed(boolean aBoolean)
public void setIsSizeRequired(boolean aBoolean)
public void setShouldAllowNull(boolean allowsNull)
public FieldTypeDefinition setLimits(int maxPrecision, int minScale, int maxScale)
public void setMaxPrecision(int maximum)
public void setMaxScale(int maximum)
public void setMinScale(int minimum)
public void setName(String name)
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_TIMESTAMPDatabasePlatform
public void setSizeDisallowed()
public void setSizeOptional()
public void setSizeRequired()
Copyright © 2023. All rights reserved.