Skip navigation links
oracle.javatools.db.datatypes
Class NumericDataType
java.lang.Object
oracle.javatools.db.AbstractDBObject
oracle.javatools.db.datatypes.PredefinedDataType
oracle.javatools.db.datatypes.NumericDataType
- All Implemented Interfaces:
- DataType, DBObject, Copyable, DynamicPropertySet
- Direct Known Subclasses:
- OracleNumberDataType
-
public class NumericDataType
- extends PredefinedDataType
- Since:
- 10.1.3
Nested Class Summary |
static class |
NumericDataType.MinMaxValue
public static class MinMaxValue defines the minimum and maximum value range of integer and floating-point numbers for use by NumericDataType.validateDefaultValue(). |
Constructor Summary |
NumericDataType()
|
NumericDataType(int domain, java.lang.String name, NumericDataType.MinMaxValue minMaxValues)
Use this constructor when the data type is a simple name with no declarable attributes, e.g. |
NumericDataType(int domain, java.lang.String name, java.lang.String definition, DataTypeAttribute[] attributes, NumericDataType.MinMaxValue minMaxValues)
Use this constructor when the data type has declarable attributes, e.g. |
NumericDataType(int domain, java.lang.String name, java.lang.String definition, long minPrecision, long maxPrecision, java.lang.Long defaultPrecision, boolean isPrecisionMandatory, DataTypeAttribute[] attributes, NumericDataType.MinMaxValue minMaxValues)
Use this constructor when the datatype has declarable precision, e.g. |
NumericDataType(int domain, java.lang.String name, java.lang.String definition, long minPrecision, long maxPrecision, java.lang.Long defaultPrecision, boolean isPrecisionMandatory, long minScale, java.lang.Long maxScale, java.lang.Long defaultScale, boolean isScaleMandatory, DataTypeAttribute[] attributes, NumericDataType.MinMaxValue minMaxValues)
Use this constructor when the number type has declarable precision and scale, e.g. |
Methods inherited from class oracle.javatools.db.datatypes.PredefinedDataType |
addAttribute, addAttribute, createDefaultUsage, createUsage, createUsage, getDataTypeAttribute, getDataTypeAttributes, getDDL, getParent, getType, hasDataTypeAttribute, matches, parseDefaultValue, removeAttribute, setDataTypeAttributes, tokenize, validateDefinition |
Methods inherited from class oracle.javatools.db.AbstractDBObject |
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setID, setName, setProperties, setProperty, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.javatools.db.DBObject |
copyTo, copyTo, copyTo, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getReferenceIDs, replaceReferenceIDs, setID, setName |
UNSIGNED
public static final DataTypeAttribute UNSIGNED
- Standard definition of UNSIGNED data type attribute
MIN_MAX_BIGINT
public static final NumericDataType.MinMaxValue MIN_MAX_BIGINT
- Standard definitions of integer MinMaxValues.
MIN_MAX_INT
public static final NumericDataType.MinMaxValue MIN_MAX_INT
MIN_MAX_MEDIUMINT
public static final NumericDataType.MinMaxValue MIN_MAX_MEDIUMINT
MIN_MAX_SMALLINT
public static final NumericDataType.MinMaxValue MIN_MAX_SMALLINT
MIN_MAX_SIGNED_TINYINT
public static final NumericDataType.MinMaxValue MIN_MAX_SIGNED_TINYINT
MIN_MAX_UNSIGNED_TINYINT
public static final NumericDataType.MinMaxValue MIN_MAX_UNSIGNED_TINYINT
MIN_MAX_MONEY
public static final NumericDataType.MinMaxValue MIN_MAX_MONEY
MIN_MAX_SMALLMONEY
public static final NumericDataType.MinMaxValue MIN_MAX_SMALLMONEY
MIN_MAX_BIT
public static final NumericDataType.MinMaxValue MIN_MAX_BIT
NumericDataType
public NumericDataType()
NumericDataType
public NumericDataType(int domain,
java.lang.String name,
NumericDataType.MinMaxValue minMaxValues)
- Use this constructor when the data type is a simple name with no declarable attributes, e.g. Oracle integer and the floating-point(approximate) number types REAL and DOUBLE PRECISION. minMaxValues is used by validateDefaultValue().
- Parameters:
domain
- : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name
- : data type name
minMaxValues
- : the min and max permissible value for this type
NumericDataType
public NumericDataType(int domain,
java.lang.String name,
java.lang.String definition,
DataTypeAttribute[] attributes,
NumericDataType.MinMaxValue minMaxValues)
- Use this constructor when the data type has declarable attributes, e.g. Adaptive Server Anywhere [<unsigned>]BIGINT minMaxValues is used by validateDefaultValue().
- Parameters:
domain
- : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name
- : data type name
definition
- : BNF definition of this data type
attributes
- : definitions of this type's attributes
minMaxValues
- : the min and max permissible value for this type
NumericDataType
public NumericDataType(int domain,
java.lang.String name,
java.lang.String definition,
long minPrecision,
long maxPrecision,
java.lang.Long defaultPrecision,
boolean isPrecisionMandatory,
DataTypeAttribute[] attributes,
NumericDataType.MinMaxValue minMaxValues)
- Use this constructor when the datatype has declarable precision, e.g. Oracle FLOAT(<precision>). Add additional attributes with the attributes parameter. For fixed-point number types, defaultPrecision should be non-zero, and minMaxValues should be null as the minumum and maximum permissible default value for the type is determined by the declared or default precision. If you do supply minMaxValues for a fixed-point number type it will be used for default value validation instead of minPrecision and maxPrecision. For floating-point number types, defaultPrecision should be null, and minMaxValues specified.
- Parameters:
domain
- : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name
- : data type name
definition
- : BNF definition of this data type
minPrecision
- : the minimum declarable precision of the data type
maxPrecision
- : the maximum declarable precision of the data type
defaultPrecision
- : default precision for optional fixed-point numbers, default precision for initialising UI of mandatory fixed-point numbers, null for floating-point numbers.
isPrecisionMandatory
- : TRUE if the precision must be specified
attributes
- : definitions of additional attributes
minMaxValues
- : the min and max permissible value for this type
NumericDataType
public NumericDataType(int domain,
java.lang.String name,
java.lang.String definition,
long minPrecision,
long maxPrecision,
java.lang.Long defaultPrecision,
boolean isPrecisionMandatory,
long minScale,
java.lang.Long maxScale,
java.lang.Long defaultScale,
boolean isScaleMandatory,
DataTypeAttribute[] attributes,
NumericDataType.MinMaxValue minMaxValues)
- Use this constructor when the number type has declarable precision and scale, e.g. Oracle NUMBER and SQL Server DECIMAL. Add additional attributes with the attributes parameter. For fixed-point number types, defaultPrecision should be non-zero, and minMaxValues should be null as the minumum and maximum permissible default value for the type is determined by the declared or default precision. If you do supply minMaxValues for a fixed-point number type it will be used for default value validation instead of minPrecision and maxPrecision. For floating-point number types, defaultPrecision should be null, and minMaxValues specified. Beware of number types like Oracle's NUMBER which are fixed-point when declared with precision (and scale), and floating point when declared with neither. In this case defaultPrecision should be null, defaultScale should be the scale when not declared, and minValue and maxValue be specified.
- Parameters:
domain
- : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name
- : data type name
definition
- : BNF definition of this data type
minPrecision
- : the minimum declarable precision of the data type
maxPrecision
- : the maximum declarable precision of the data type
defaultPrecision
- : default precision for optional fixed-point numbers, default precision for initialising UI of mandatory exact numbers, null for floating-point numbers.
isPrecisionMandatory
- : TRUE if the precision must be specified
minScale
- : the minimum declarable scale of the data type
maxScale
- : the maximum declarable scale of the data type, or null if s <= p
defaultScale
- : default scale for optional exact numbers, default scale for initialising UI of mandatory exact numbers, null for approximate numbers.
isScaleMandatory
- : TRUE if the scale must be specified
attributes
- : definitions of additional attributes
minMaxValues
- : the min and max permissible value for this type
copyToImpl
protected void copyToImpl(AbstractDBObject other,
DBObject copyParent,
IDPolicy idPolicy)
- Description copied from class:
AbstractDBObject
- Implementation method for making a copy of this object. To add custom copyTo logic, a subclass must override this method (exactly), and must call back to the super implementation.
-
- Overrides:
copyToImpl
in class PredefinedDataType
-
- Parameters:
other
- the copy being created of this object
copyParent
- if this object is being copied underneath a parent, this parameter is the copy of the parent of this object, which will therefore need to be the parent of the copy of this object.
idPolicy
- the policy for copying the object's ID.
equalsImpl
protected boolean equalsImpl(AbstractDBObject target)
- Description copied from class:
AbstractDBObject
- Equals implementation for testing equality with another AbstractDBObject. Override this method (with exact signature) to customise the equality comparison.
-
- Overrides:
equalsImpl
in class PredefinedDataType
validateUsage
public void validateUsage(DataTypeUsage dataTypeUsage,
DBObject dbObject)
throws DataTypeValidationException
- Validates dataTypeUsage against self's definition. Uses dataTypeUsage's get() methods to get the actual property values for validation. Method should be overridden by sub-classes to do sub-class validation.
-
- Specified by:
validateUsage
in interface DataType
- Overrides:
validateUsage
in class PredefinedDataType
-
- Parameters:
dataTypeUsage
- : the usage to be validated
dbObject
- : the context of the data type usage
- Throws:
DataTypeValidationException
validateDefaultValue
public void validateDefaultValue(java.lang.Object defaultValue,
DataTypeUsage dataTypeUsage,
DBObject dbObject)
throws DefaultValueValidationException
- Validates defaultValue for dataTypeUsage against the declared precision, scale and min and max values of this numeric type.
-
- Specified by:
validateDefaultValue
in interface DataType
- Overrides:
validateDefaultValue
in class PredefinedDataType
-
- Parameters:
dataTypeUsage
- : the usage to be validated
defaultValue
- : the default value
dbObject
- : the context of the data type usage
- Throws:
DataTypeValidationException
DefaultValueValidationException
Skip navigation links
Copyright © 1997, 2012, Oracle. All rights reserved.