wt.introspection
Class WTIntrospector

java.lang.Object
  extended bywt.introspection.WTIntrospector

public class WTIntrospector
extends Object

WTIntrospector is a factory for class info objects.

Supported API: true

Extendable: false

See Also:
ClassInfo, LinkInfo

Field Summary
static String ARRAY_TYPE
          Key to access the Array ObjectType extended value from a ClassInfo.
static String CHANGEABLE
          Key to access the Changeable setting (as a wt.introspection.ChangeableKind) from a PropertyDescriptor obtained from a ClassInfo.
private static Hashtable classInfoCache
           
private static String CLASSNAME
           
static String CONSTRAINED_TYPE
          Key to access the ConstrainedType (as a String), if it is constrained, from a PropertyDescriptor obtained from a ClassInfo.
static boolean DEBUG
           
static String DEFINED_AS
          Key to access the Fully Qualified Name of the Property, as it was defined (modeled).
static String DERIVED
          Key to access the Derived setting from a PropertyDescriptor obtained from a ClassInfo.
(package private) static String DISPLAY_ENTRY
          Temporary, to support display name utility
static String INCREMENT
          Key to access the Sequence Increment extended value from a ClassInfo.
static String INFO_EXTENSION
          The extension used for serialized ClassInfo files.
private static Hashtable infoCache
           
static String INITIAL_VALUE
          Key to access the Initial Value setting from a PropertyDescriptor obtained from a ClassInfo.
static String LOCALIZABLE
          Key to access the Localizable setting from a PropertyDescriptor obtained from a ClassInfo.
private static DebugWriter LOG
           
static String LOWER_LIMIT
          Key to access the Lower Limit from a PropertyDescriptor obtained from a ClassInfo.
static String MODEL_RESOURCE_SUFFIX
          The suffix used for resource files related to modeled information.
static String MODELED_PERSISTENT_TYPE
          Key to access the ColumnType from a PropertyDescriptor obtained from a ClassInfo.
private static MappedRegistry modelRegistry
           
private static String MODELREGISTRY
           
private static Hashtable noClassInfo
           
static String OBJECT_NAME
          Key to access the datastore ObjectName extended value from a ClassInfo.
static String ORACLE_OPTIONS
          Key to access the Oracle Options extended value from a ClassInfo.
static String PERSISTENT
          Key to access the Persistence setting from a PropertyDescriptor obtained from a ClassInfo.
static String QUERY_NAME
          Key to access the Query Name from a PropertyDescriptor obtained from a ClassInfo.
static String REQUIRED
          Key to access the Required setting from a PropertyDescriptor obtained from a ClassInfo.
private static String RESOURCE
           
static String SEED
          Key to access the Sequence Seed extended value from a ClassInfo.
private static String SIMPLE_CLASSNAME
           
static String SQL_SERVER_OPTIONS
          Key to access the SQLServer Options extended value from a ClassInfo.
static String STEREOTYPE
          Key to access the Stereotype from a PropertyDescriptor obtained from a ClassInfo.
static String STRING_CASE
          Key to access the StringCase setting (as a wt.util.CaseKind) from a PropertyDescriptor obtained from a ClassInfo.
static String UPDATEABLE
          Key to access the Updateable setting from a PropertyDescriptor obtained from a ClassInfo.
static String UPPER_LIMIT
          Key to access the Upper Limit from a PropertyDescriptor obtained from a ClassInfo.
static String VALUE_SET_METHOD
          Key to access the Method object, that returns the valid value set, from a PropertyDescriptor obtained from a ClassInfo.
 
Constructor Summary
private WTIntrospector()
           
 
Method Summary
static ClassInfo getClassInfo(Class aClass)
          Gets class meta info.
static ClassInfo getClassInfo(String aClassname)
          Gets class meta info.
static ClassInfo getClassInfo(String aClassname, String dir)
          Gets class meta info.
static ClassInfo getClassInfoByAttribute(String attribute)
          Gets class meta info.
static DatabaseInfo getDatabaseInfo(String aClassname)
          Gets database meta info for a class.
static DatabaseInfo getDatabaseInfo(String aClassname, String dir)
          Gets database meta info for a class.
static LinkInfo getLinkInfo(Class aClass)
          Gets class meta info.
static LinkInfo getLinkInfo(String aClassname)
          Gets link class meta info.
static LinkInfo getLinkInfo(String aClassname, String dir)
          Gets link class meta info.
static Class getValidType(PropertyDescriptor pd)
          Get the valid type for a PropertyDescriptor.
static String getValidTypeName(PropertyDescriptor pd)
          Get the name of the valid type for a PropertyDescriptor.
static boolean isFunction(String expression)
          Determines if an expression contains a function call.
private static ClassInfo loadInfo(String aClassname, String dir)
           
static PropertyDescriptor newPropertyDescriptor(PropertyDescriptor old)
          Create a new PropertyDescriptor by copying values from an existing PropertyDescriptor.
static PropertyDescriptor newPropertyDescriptor(PropertyDescriptor x, PropertyDescriptor y)
          Merge information from two PropertyDescriptors.
static String truncatedColumnName(String columnName)
          Computes the truncated column name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

SIMPLE_CLASSNAME

private static final String SIMPLE_CLASSNAME

DEBUG

public static final boolean DEBUG

LOG

private static final DebugWriter LOG

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

MODELREGISTRY

private static final String MODELREGISTRY
See Also:
Constant Field Values

infoCache

private static Hashtable infoCache

classInfoCache

private static Hashtable classInfoCache

noClassInfo

private static Hashtable noClassInfo

modelRegistry

private static MappedRegistry modelRegistry

INFO_EXTENSION

public static final String INFO_EXTENSION
The extension used for serialized ClassInfo files.

Supported API: true

See Also:
Constant Field Values

MODEL_RESOURCE_SUFFIX

public static final String MODEL_RESOURCE_SUFFIX
The suffix used for resource files related to modeled information.

Supported API: true

See Also:
Constant Field Values

STEREOTYPE

public static final String STEREOTYPE
Key to access the Stereotype from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

DERIVED

public static final String DERIVED
Key to access the Derived setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

PERSISTENT

public static final String PERSISTENT
Key to access the Persistence setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

QUERY_NAME

public static final String QUERY_NAME
Key to access the Query Name from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

STRING_CASE

public static final String STRING_CASE
Key to access the StringCase setting (as a wt.util.CaseKind) from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

INITIAL_VALUE

public static final String INITIAL_VALUE
Key to access the Initial Value setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

REQUIRED

public static final String REQUIRED
Key to access the Required setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

LOWER_LIMIT

public static final String LOWER_LIMIT
Key to access the Lower Limit from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

UPPER_LIMIT

public static final String UPPER_LIMIT
Key to access the Upper Limit from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

UPDATEABLE

public static final String UPDATEABLE
Key to access the Updateable setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

CHANGEABLE

public static final String CHANGEABLE
Key to access the Changeable setting (as a wt.introspection.ChangeableKind) from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

VALUE_SET_METHOD

public static final String VALUE_SET_METHOD
Key to access the Method object, that returns the valid value set, from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

CONSTRAINED_TYPE

public static final String CONSTRAINED_TYPE
Key to access the ConstrainedType (as a String), if it is constrained, from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

DEFINED_AS

public static final String DEFINED_AS
Key to access the Fully Qualified Name of the Property, as it was defined (modeled).

Supported API: true

See Also:
Constant Field Values

LOCALIZABLE

public static final String LOCALIZABLE
Key to access the Localizable setting from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

MODELED_PERSISTENT_TYPE

public static final String MODELED_PERSISTENT_TYPE
Key to access the ColumnType from a PropertyDescriptor obtained from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

DISPLAY_ENTRY

static final String DISPLAY_ENTRY
Temporary, to support display name utility

See Also:
Constant Field Values

OBJECT_NAME

public static final String OBJECT_NAME
Key to access the datastore ObjectName extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

ORACLE_OPTIONS

public static final String ORACLE_OPTIONS
Key to access the Oracle Options extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

SQL_SERVER_OPTIONS

public static final String SQL_SERVER_OPTIONS
Key to access the SQLServer Options extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

ARRAY_TYPE

public static final String ARRAY_TYPE
Key to access the Array ObjectType extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

SEED

public static final String SEED
Key to access the Sequence Seed extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values

INCREMENT

public static final String INCREMENT
Key to access the Sequence Increment extended value from a ClassInfo.

Supported API: true

See Also:
Constant Field Values
Constructor Detail

WTIntrospector

private WTIntrospector()
Method Detail

getClassInfo

public static ClassInfo getClassInfo(Class aClass)
                              throws WTIntrospectionException
Gets class meta info.

Supported API: true

Parameters:
aClass - is the target class
Returns:
the ClassInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getClassInfo

public static ClassInfo getClassInfo(String aClassname)
                              throws WTIntrospectionException
Gets class meta info.

Supported API: true

Parameters:
aClassname - is the full qualified name of the target class
Returns:
the ClassInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getClassInfo

public static ClassInfo getClassInfo(String aClassname,
                                     String dir)
                              throws WTIntrospectionException
Gets class meta info.

Supported API: true

Parameters:
aClassname - is the full qualified name of the target class
dir - is the root directory under which ClassInfo's are located
Returns:
the ClassInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getClassInfoByAttribute

public static ClassInfo getClassInfoByAttribute(String attribute)
                                         throws WTIntrospectionException
Gets class meta info.

Supported API: true

Parameters:
attribute - is a fully qualified attribute name
Returns:
the ClassInfo instance for the class holding this attribute
Throws:
WTIntrospectionException - if class info cannot be loaded

isFunction

public static boolean isFunction(String expression)
Determines if an expression contains a function call.

Supported API: false

Parameters:
expression - string that may contain function call
Returns:
true if the expression contains a function call or other operations, otherwise false

getDatabaseInfo

public static DatabaseInfo getDatabaseInfo(String aClassname)
                                    throws WTIntrospectionException
Gets database meta info for a class.

Supported API: false

Parameters:
aClassname - is the full qualified name of the target class
Returns:
the DatabaseInfo instance for the requested class
Throws:
WTIntrospectionException - if database info cannot be loaded

getDatabaseInfo

public static DatabaseInfo getDatabaseInfo(String aClassname,
                                           String dir)
                                    throws WTIntrospectionException
Gets database meta info for a class.

Supported API: false

Parameters:
aClassname - is the full qualified name of the target class
dir - is the root directory under which ClassInfo's are located
Returns:
the DatabaseInfo instance for the requested class
Throws:
WTIntrospectionException - if database info cannot be loaded

getLinkInfo

public static LinkInfo getLinkInfo(Class aClass)
                            throws WTIntrospectionException
Gets class meta info.

Supported API: true

Parameters:
aClass - is the target link class
Returns:
the LinkInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getLinkInfo

public static LinkInfo getLinkInfo(String aClassname)
                            throws WTIntrospectionException
Gets link class meta info.

Supported API: true

Parameters:
aClassname - is the full qualified name of the target class
Returns:
the LinkInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getLinkInfo

public static LinkInfo getLinkInfo(String aClassname,
                                   String dir)
                            throws WTIntrospectionException
Gets link class meta info.

Supported API: true

Parameters:
aClassname - is the full qualified name of the target class
dir - is the root directory under which ClassInfo's are located
Returns:
the LinkInfo instance for the requested class
Throws:
WTIntrospectionException - if class info cannot be loaded

getValidType

public static Class getValidType(PropertyDescriptor pd)
                          throws WTIntrospectionException
Get the valid type for a PropertyDescriptor. It will use the CONSTRAINED_TYPE if one exists, otherwise it will use the propertyType.

Supported API: true

Parameters:
pd - The target PropertyDescriptor.
Returns:
The type of Class that is valid for the PropertyDescriptor.
Throws:
WTIntrospectionException - if fails to construct new PropertyDescriptor.

getValidTypeName

public static String getValidTypeName(PropertyDescriptor pd)
                               throws WTIntrospectionException
Get the name of the valid type for a PropertyDescriptor. It will use the CONSTRAINED_TYPE if one exists, otherwise it will use the propertyType.

Supported API: true

Parameters:
pd - The target PropertyDescriptor.
Returns:
The name of the type that is valid for the PropertyDescriptor.
Throws:
WTIntrospectionException - if fails to construct new PropertyDescriptor.

loadInfo

private static ClassInfo loadInfo(String aClassname,
                                  String dir)
                           throws WTIntrospectionException
Throws:
WTIntrospectionException

newPropertyDescriptor

public static PropertyDescriptor newPropertyDescriptor(PropertyDescriptor old)
                                                throws IntrospectionException
Create a new PropertyDescriptor by copying values from an existing PropertyDescriptor.

Supported API: false

Parameters:
old - existing PropertyDescriptor
Returns:
new PropertyDescriptor
Throws:
IntrospectionException - if fails to construct new PropertyDescriptor

newPropertyDescriptor

public static PropertyDescriptor newPropertyDescriptor(PropertyDescriptor x,
                                                       PropertyDescriptor y)
                                                throws IntrospectionException
Merge information from two PropertyDescriptors. The merged hidden, expert, bound & constrained flags are formed by or-ing the values. In the event of other conflicts, the second argument (y) is given priority over the first argument (x).

Supported API: false

Parameters:
x - The first (lower priority) PropertyDescriptor
y - The second (higher priority) PropertyDescriptor
Returns:
new PropertyDescriptor
Throws:
IntrospectionException - if fails to construct new PropertyDescriptor

truncatedColumnName

public static String truncatedColumnName(String columnName)
Computes the truncated column name.

Supported API: false

Returns:
the column name, truncated (as necessary) to the maximum column name length.