Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.javatools.db.datatypes
Class PredefinedDataType

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObject
      extended by oracle.javatools.db.datatypes.PredefinedDataType
All Implemented Interfaces:
DataType, DBObject, Copyable, DynamicPropertySet
Direct Known Subclasses:
BaseDateTimeDataType, BinaryDataType, CharacterDataType, NumericDataType, UserDataType

public class PredefinedDataType
extends AbstractDBObject
implements DataType

Since:
10.1.3

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport
 
Field Summary
 
Fields inherited from interface oracle.javatools.db.datatypes.DataType
PCTROWTYPE, PCTTYPE, REF, TYPE
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
Constructor Summary
PredefinedDataType()
           
PredefinedDataType(int domain, java.lang.String name)
          Use this constructor when the data type is a simple name with no declarable attributes, e.g.
PredefinedDataType(int domain, java.lang.String name, java.lang.String definition, DataTypeAttribute[] attributes)
          Use this constructor when the datatype is not just a simple name, but has declarable attributes, e.g.
PredefinedDataType(int domain, java.lang.String name, java.lang.String definition, long minSize, long maxSize, long defaultSize, boolean isSizeMandatory, DataTypeAttribute[] attributes)
          Use this constructor when the data type has a declarable maximum size, e.g.
 
Method Summary
 void addAttribute(DataTypeAttribute attribute)
           
 void addAttribute(DataTypeAttribute attribute, int atIndex)
           
 DBObject copyTo(DBObject target, DBObject copyParent, IDPolicy idPolicy)
          Internal copy method used by the API to perform copy operations.
protected  void copyToImpl(PredefinedDataType target, DBObject copyParent, IDPolicy idPolicy)
           
 DataTypeUsage createDefaultUsage()
          Returns an DataTypeUsage object for this type.
 DataTypeUsage createUsage(java.util.Map<java.lang.String,java.lang.Object> attributeValues)
          Returns an DataTypeUsage object for this type, populated with attributes.
 DataTypeUsage createUsage(java.lang.String usageString)
          Returns an DataTypeUsage object for this type, populated with attributes based on the usageString.
 boolean equals(java.lang.Object obj)
           
protected  boolean equalsImpl(PredefinedDataType other)
           
 DataTypeAttribute getDataTypeAttribute(java.lang.String name)
          Returns the DataTypeAttribute called name or null if this data type doesn't define it.
 DataTypeAttribute[] getDataTypeAttributes()
          Returns an array of this type's DataTypeAttributes in the order they were added to this type.
 java.lang.String getDDL(DataTypeUsage dataTypeUsage)
          Generates the DDL for this type.
 DBObject getParent()
          Returns the parent of this object, if one exists.
 java.lang.String getType()
          Returns the type of this object.
 boolean hasDataTypeAttribute(java.lang.String name)
          Returns true if the DataTypeAttribute name is on this DataType.
 boolean matches(java.lang.String usageString)
          Returns true if the usageString is valid syntax for the DataType, false otherwise.
protected static PlsqlNode parseDefaultValue(java.lang.String strDefaultValue, DataType dataType, DBObject dbObject)
          Parse the default value.
 void removeAttribute(DataTypeAttribute attribute)
           
protected static java.lang.String[] tokenize(java.lang.String string, java.lang.String delimiters)
          Creates a String[] of tokens extracted from string.
 void validateDefaultValue(java.lang.Object defaultValue, DataTypeUsage dataTypeUsage, DBObject dbObject)
          Validates defaultValue for dataTypeUsage against self's definition.
 void validateDefinition()
          Validate BNF definition methods.
 void validateUsage(DataTypeUsage dataTypeUsage, DBObject dbObject)
          Validates dataTypeUsage against self's definition.
 
Methods inherited from class oracle.javatools.db.AbstractDBObject
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyToImpl, equalsImpl, 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
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, getProperty, setProperties, setProperty
 

Constructor Detail

PredefinedDataType

public PredefinedDataType()

PredefinedDataType

public PredefinedDataType(int domain,
                          java.lang.String name)
Use this constructor when the data type is a simple name with no declarable attributes, e.g. Oracle BFILE and ROWID.

Parameters:
domain - : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name -

PredefinedDataType

public PredefinedDataType(int domain,
                          java.lang.String name,
                          java.lang.String definition,
                          DataTypeAttribute[] attributes)
Use this constructor when the datatype is not just a simple name, but has declarable attributes, e.g. Oracle TIMESTAMP[(<scale>)][ WITH <zone>].

Parameters:
domain - : Context of data type definition, e.g. column, variable. Domains are specific to each database and are defined in their interface.
name - : Lookup and display name of this data type
definition - : BNF definition of this data type
attributes - : Definitions of this data type's attributes

PredefinedDataType

public PredefinedDataType(int domain,
                          java.lang.String name,
                          java.lang.String definition,
                          long minSize,
                          long maxSize,
                          long defaultSize,
                          boolean isSizeMandatory,
                          DataTypeAttribute[] attributes)
Use this constructor when the data type has a declarable maximum size, e.g. DB2 BLOB[(<size>[ <units>])]. Add additional attributes, e.g. <units>, with the attributes parameter.

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
minSize - : the minimum size of this data type
maxSize - : the maximum size of this data type
defaultSize - : size of data type when size is optional and not declared, default size for UI when size is mandatory.
isSizeMandatory - : TRUE when size has to be declared
attributes - : Definitions of additional attributes
Method Detail

addAttribute

public final void addAttribute(DataTypeAttribute attribute)

addAttribute

public final void addAttribute(DataTypeAttribute attribute,
                               int atIndex)

removeAttribute

public final void removeAttribute(DataTypeAttribute attribute)

createDefaultUsage

public DataTypeUsage createDefaultUsage()
Description copied from interface: DataType
Returns an DataTypeUsage object for this type. Used by UI to create a default data type usage. Mandatory declarable attributes of the data type are initialised with appropriate values, e.g. the size of a usage of an Oracle VARCHAR2 data type would be set to 4000, its maximum. Should be overridden by sub-classes to return an object of the sub-class type.

Specified by:
createDefaultUsage in interface DataType

createUsage

public DataTypeUsage createUsage(java.util.Map<java.lang.String,java.lang.Object> attributeValues)
Description copied from interface: DataType
Returns an DataTypeUsage object for this type, populated with attributes. Should be overridden by sub-classes to return an object of the sub-class type.

Specified by:
createUsage in interface DataType

validateUsage

public void validateUsage(DataTypeUsage dataTypeUsage,
                          DBObject dbObject)
                   throws DataTypeValidationException
Description copied from interface: DataType
Validates dataTypeUsage against self's definition. Uses dataTypeUSage's get() methods to get the actual property values for validation. Should be overridden by sub-classes to do sub-class validation.

Specified by:
validateUsage in interface DataType
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
Description copied from interface: DataType
Validates defaultValue for dataTypeUsage against self's definition. Method should be overridden by sub-classes to do sub-class validation.

Specified by:
validateDefaultValue in interface DataType
Parameters:
defaultValue - : the default value
dataTypeUsage - : the usage to be validated
dbObject - : the context of the data type usage
Throws:
DefaultValueValidationException

getDDL

public java.lang.String getDDL(DataTypeUsage dataTypeUsage)
Description copied from interface: DataType
Generates the DDL for this type. Uses dataTypeUsages's get() methods to get the actual property values. Should be overridden by sub-classes to generate extra bits.

Specified by:
getDDL in interface DataType

hasDataTypeAttribute

public final boolean hasDataTypeAttribute(java.lang.String name)
Returns true if the DataTypeAttribute name is on this DataType.

Specified by:
hasDataTypeAttribute in interface DataType
Returns:
true if the DataTypeAttribute corresponding to name exists.

getDataTypeAttribute

public final DataTypeAttribute getDataTypeAttribute(java.lang.String name)
Returns the DataTypeAttribute called name or null if this data type doesn't define it.

Specified by:
getDataTypeAttribute in interface DataType
Parameters:
name -
Returns:
The DataTypeAttribute corresponding to name or null if none exists.

getDataTypeAttributes

public final DataTypeAttribute[] getDataTypeAttributes()
Returns an array of this type's DataTypeAttributes in the order they were added to this type.

Specified by:
getDataTypeAttributes in interface DataType
Returns:
DataType's DataTypeAttributes in the order they were added.

getParent

public final DBObject getParent()
Description copied from interface: DBObject
Returns the parent of this object, if one exists. This does not return the Schema for a SchemaObject. Schema's are not considered part of the ownership parent tree.

Specified by:
getParent in interface DBObject

getType

public final java.lang.String getType()
Description copied from interface: DBObject
Returns the type of this object. Valid types include things like tables, views, synonyms, and columns.

Specified by:
getType in interface DBObject
Returns:
a string describing the type of object.

copyTo

public DBObject copyTo(DBObject target,
                       DBObject copyParent,
                       IDPolicy idPolicy)
Description copied from class: AbstractDBObject
Internal copy method used by the API to perform copy operations. All objects must implement this method if they are instantiable objects. Abstract objects (e.g. Relation) must NOT implement this method. The implementation should delegate to the copyToImpl method to copy the actual properties.

This method does not fix internal reference ids on copy. That is done by the calling DBObject.copyTo(DBObject, IDPolicy) method.

Specified by:
copyTo in class AbstractDBObject
See Also:
DBObject.copyTo(java.lang.Object), DBObject.copyTo(DBObject, boolean), AbstractDBObject.copyToImpl(oracle.javatools.db.AbstractDBObject, oracle.javatools.db.DBObject, oracle.javatools.db.IDPolicy)

copyToImpl

protected void copyToImpl(PredefinedDataType target,
                          DBObject copyParent,
                          IDPolicy idPolicy)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

equalsImpl

protected boolean equalsImpl(PredefinedDataType other)

validateDefinition

public void validateDefinition()
                        throws DataTypeValidationException
Validate BNF definition methods. Should be called from the unit tests to detect invalid changes or additions to data type definitions. Checks syntax and that <attribute> in BNF are set as attributes of this data type.

Throws:
DataTypeValidationException

tokenize

protected static java.lang.String[] tokenize(java.lang.String string,
                                             java.lang.String delimiters)
Creates a String[] of tokens extracted from string. The String[] that is returned contains the tokens and delimiters, except for spaces.


parseDefaultValue

protected static PlsqlNode parseDefaultValue(java.lang.String strDefaultValue,
                                             DataType dataType,
                                             DBObject dbObject)
                                      throws DefaultValueValidationException
Parse the default value. Return the Node at the top of the parse tree, or null if the parser result is not understood.

Throws:
DefaultValueValidationException - if there are parser exceptions

matches

public boolean matches(java.lang.String usageString)
Description copied from interface: DataType
Returns true if the usageString is valid syntax for the DataType, false otherwise. Should be overridden by sub-classes to do the validation.

Specified by:
matches in interface DataType

createUsage

public DataTypeUsage createUsage(java.lang.String usageString)
Description copied from interface: DataType
Returns an DataTypeUsage object for this type, populated with attributes based on the usageString. Returns null if the usageString does not match the syntax of the DataType. See DataType.matches(java.lang.String). Should be overridden by sub-classes to return an object of the sub-class type.

Specified by:
createUsage in interface DataType

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.