Skip navigation links

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

E13403-06


oracle.javatools.db.datatypes
Class DataTypeHelper

java.lang.Object
  extended by oracle.javatools.db.datatypes.DataTypeHelper


public class DataTypeHelper
extends java.lang.Object

Helper class for unwrapping the DataTypeUsage object.


Constructor Summary
DataTypeHelper()
           

 

Method Summary
static boolean canGetTypeStringFromID(DBObjectID id)
           
static DBObjectID findIDForTypeString(DBObjectProvider provider, Schema defaultSchema, java.lang.String typeString)
          From a String representing a datatype of some sort, find an ID for that type in the given provider, or return null.
static DBObjectID findOrCreateIDForTypeString(DBObjectProvider provider, Schema defaultSchema, java.lang.String typeString)
          From a String representing a datatype of some sort, find or create an ID for that type in the given provider.
static java.lang.Object getAttributeValue(java.lang.Object value, DataType dataType, java.lang.String attributeName)
          Returns an attribute value as an object of the type of the attribute.
static DataType getDataType(DataTypeUsage usage)
          Returns the DataType that usage is an instance of, or null if usage is null
static DataTypeUsage getDataTypeUsageForString(DBObjectProvider provider, Schema defaultSchema, java.lang.String usageString)
          See getDataTypeUsageForString(DBObjectProvider,Schema,String,boolean)
static DataTypeUsage getDataTypeUsageForString(DBObjectProvider provider, Schema defaultSchema, java.lang.String usageString, boolean strict)
          Returns a DataTypeUsage for the given string.
static java.lang.String getDDL(DataTypeUsage dtu)
          Gets the ddl for the give DataTypeUsage, unless something goes wrong then it'll return null.
static java.lang.Long getLongAttributeValue(DataTypeUsage usage, java.lang.String name)
          Returns the value of the given named attribute from the given DataTypeUsage as a Long.
static java.lang.String getNameFromLabel(int resourceLabelID)
           
static java.lang.String getNameFromLabel(java.lang.String resourceLabel)
           
static java.lang.String getStringAttributeDefaultValue(DataTypeUsage usage, java.lang.String attributeName)
          Returns the default value of the given named attribute from the given DataTypeUsage as a String.
static java.lang.String getStringAttributeValue(DataTypeUsage usage, java.lang.String name)
          Returns the value of the given named attribute from the given DataTypeUsage as a String.
static java.lang.String getTypeStringFromID(DBObjectID typeID, Schema defaultSchema)
          Return a fully qualified String representation of the type with the given ID, omitting the schema name if it is the same as the default schema
static boolean isXMLType(DataType type)
           
static java.lang.Long toLong(java.lang.Object usageValue)
          Returns usageValue as a Long, or null if usageValue is null or usageValue can't be converted to a number.
static java.lang.Long toLongOrError(java.lang.Object usageValue)
          Returns usageValue as a Long, or null if usageValue is null or usageValue can't be converted to a number.
static java.lang.String toString(java.lang.Object usageValue)
          Returns usageValue as a String, or null if usageValue is null.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

DataTypeHelper

public DataTypeHelper()

Method Detail

getDataType

public static DataType getDataType(DataTypeUsage usage)
                            throws DBException
Returns the DataType that usage is an instance of, or null if usage is null
Parameters:
usage - the usage to unwrap
Returns:
the DataType for the given usage
Throws:
DBException - if the usage's DBObjectID doesn't resolve to a valid DataType

getLongAttributeValue

public static java.lang.Long getLongAttributeValue(DataTypeUsage usage,
                                                   java.lang.String name)
Returns the value of the given named attribute from the given DataTypeUsage as a Long. Will return null if the attribute is missing, or the value isn't representable as a Long.

getStringAttributeValue

public static java.lang.String getStringAttributeValue(DataTypeUsage usage,
                                                       java.lang.String name)
Returns the value of the given named attribute from the given DataTypeUsage as a String. Will return null if the attribute is missing.

getStringAttributeDefaultValue

public static java.lang.String getStringAttributeDefaultValue(DataTypeUsage usage,
                                                              java.lang.String attributeName)
Returns the default value of the given named attribute from the given DataTypeUsage as a String. Will return null if the attribute is missing.

toLong

public static java.lang.Long toLong(java.lang.Object usageValue)
Returns usageValue as a Long, or null if usageValue is null or usageValue can't be converted to a number. The usage of a DataTypeAttribute that is defined as Long may not always be a Long; it may be a String or some other numeric class.
Returns:
a Long for the given Object if conversion is possible

toLongOrError

public static java.lang.Long toLongOrError(java.lang.Object usageValue)
                                    throws java.lang.NumberFormatException
Returns usageValue as a Long, or null if usageValue is null or usageValue can't be converted to a number. The usage of a DataTypeAttribute that is defined as Long may not always be a Long; it may be a String or some other numeric class.
Returns:
a Long for the given Object if conversion is possible
Throws:
java.lang.NumberFormatException

toString

public static java.lang.String toString(java.lang.Object usageValue)
Returns usageValue as a String, or null if usageValue is null. The usage of a DataTypeAttribute that is defined as String may not always be a String, e.g. if it the attribute is an enumeration of numeric values the attribute will be defined as String but the usage may be stored as a numeric class like Long.

getNameFromLabel

public static java.lang.String getNameFromLabel(int resourceLabelID)

getNameFromLabel

public static java.lang.String getNameFromLabel(java.lang.String resourceLabel)

getAttributeValue

public static java.lang.Object getAttributeValue(java.lang.Object value,
                                                 DataType dataType,
                                                 java.lang.String attributeName)
Returns an attribute value as an object of the type of the attribute.
Parameters:
value - : value to be converted
dataType - : data type of value
attributeName - : name of the attribute

getDDL

public static java.lang.String getDDL(DataTypeUsage dtu)
Gets the ddl for the give DataTypeUsage, unless something goes wrong then it'll return null.

canGetTypeStringFromID

public static boolean canGetTypeStringFromID(DBObjectID id)

getTypeStringFromID

public static java.lang.String getTypeStringFromID(DBObjectID typeID,
                                                   Schema defaultSchema)
Return a fully qualified String representation of the type with the given ID, omitting the schema name if it is the same as the default schema
Parameters:
typeID -
defaultSchema -

findOrCreateIDForTypeString

public static DBObjectID findOrCreateIDForTypeString(DBObjectProvider provider,
                                                     Schema defaultSchema,
                                                     java.lang.String typeString)
From a String representing a datatype of some sort, find or create an ID for that type in the given provider.
Parameters:
typeString -
provider -
defaultSchema -
Returns:
the DBObjectID of the datatype

findIDForTypeString

public static DBObjectID findIDForTypeString(DBObjectProvider provider,
                                             Schema defaultSchema,
                                             java.lang.String typeString)
From a String representing a datatype of some sort, find an ID for that type in the given provider, or return null.
Parameters:
typeString -
provider -
defaultSchema -
Returns:
the DBObjectID of the datatype

getDataTypeUsageForString

public static DataTypeUsage getDataTypeUsageForString(DBObjectProvider provider,
                                                      Schema defaultSchema,
                                                      java.lang.String usageString)
See getDataTypeUsageForString(DBObjectProvider,Schema,String,boolean)

getDataTypeUsageForString

public static DataTypeUsage getDataTypeUsageForString(DBObjectProvider provider,
                                                      Schema defaultSchema,
                                                      java.lang.String usageString,
                                                      boolean strict)
Returns a DataTypeUsage for the given string. If strict == true and no underlying DataType can be found, then null is returned. If strict == false (or is omitted) and an underlying DataType cannot be found, an ObjectTypeUsage with a ReferenceID for the DataType will be returned.
Parameters:
provider -
defaultSchema -
usageString -
strict -
Returns:

isXMLType

public static boolean isXMLType(DataType type)

Skip navigation links

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

E13403-06


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