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

E13403-04

oracle.javatools.db.property
Class Metadata

java.lang.Object
  extended by oracle.javatools.db.property.Metadata

public class Metadata
extends java.lang.Object

The database API contains a number of bean classes that represent the objects that can exist in a database (e.g. Tables, Columns, Constraints). This class provides meta-information about these bean classes and the properties available on them.

Since:
11

Method Summary
 java.util.Collection<java.lang.String> getAllTypes(java.lang.Class<? extends DBObject> clz)
          Gets all the valid DBObject types for the given class, including all subclasses and implementations.
 java.util.Map<java.lang.String,java.lang.Class<? extends DBObject>> getDBObjectClasses()
          The returned map contains a mapping of DBObject types to their declaring DBObject subclasses.
static Metadata getInstance()
          Gets the metadata for the database API.
 java.lang.Class<? extends DBObject> getObjectClass(java.lang.String type)
          Gets the DBObject class that corresponds to the given object type.
 java.util.Collection<java.lang.String> getSupportedProperties(java.lang.Class<? extends DBObject> objClz, java.lang.Class<? extends DBObjectProvider> proClz)
          Gets the supported properties, both defined on the bean class and also any extra properties registered via annotations or extensions, for the given object class in the context of the given provider class.
static java.lang.String getType(java.lang.Class<? extends DBObject> objClass)
          Returns the type defined for the given object class.
static boolean isRealBean(java.lang.Class<? extends Copyable> clz)
          Tests whether the given bean class is a concrete bean - i.e.
 boolean isSchemaObject(java.lang.String type)
          Returns true if the given DBObject type represents a SchemaObject.
 boolean isTypeOf(java.lang.Class<? extends DBObject> clz, java.lang.String type)
          Tests whether the given object type corresponds to a subclass of the given object class.
 DBObject newDBObject(java.lang.String type, java.lang.String name)
          Creates a new DBObject of given type, and sets it up with a name.
 DBObject newInstance(java.lang.String type)
          Creates a new instance of a DBObject of the given type.
 void registerProperty(java.lang.String name, java.lang.Class returnType, java.lang.Class<? extends DBObjectProvider> providerType, java.lang.Class<? extends DBObject>... objectTypes)
          Registers a new property in the APIs metadata for a given object class and provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Metadata getInstance()
Gets the metadata for the database API.


getDBObjectClasses

public java.util.Map<java.lang.String,java.lang.Class<? extends DBObject>> getDBObjectClasses()
The returned map contains a mapping of DBObject types to their declaring DBObject subclasses. The DBObject subclass could be an interface.

Returns:
mappings of type to DBObject subclass

isSchemaObject

public boolean isSchemaObject(java.lang.String type)
Returns true if the given DBObject type represents a SchemaObject. Convinience method that just calls isTypeOf( SchemaObject.class, type )


isTypeOf

public boolean isTypeOf(java.lang.Class<? extends DBObject> clz,
                        java.lang.String type)
Tests whether the given object type corresponds to a subclass of the given object class. For example to see if a type is a valid Relation:
   boolean isRelation = Metadata.getInstance().isTypeOf( Relation.class, type );
 

Parameters:
clz - the class to query (e.g. SystemObject.class)
type - the database object type (e.g. Table.TYPE )
Returns:
true if type corresponds to a valid subclass of clz

newDBObject

public DBObject newDBObject(java.lang.String type,
                            java.lang.String name)
Creates a new DBObject of given type, and sets it up with a name. Returns null if an object cannot be instantiated, or if the given object type has more than one registered implementation (e.g. Constraint).

Parameters:
type - the type of object to create
name - the name to give the object (optional)
Returns:
a new object of the given type setup with the given name, or null if a object couldn't be instantiated.

getObjectClass

public java.lang.Class<? extends DBObject> getObjectClass(java.lang.String type)
Gets the DBObject class that corresponds to the given object type.

Parameters:
type - the object type to lookup
Returns:
the DBObject subclass for that type

getAllTypes

public java.util.Collection<java.lang.String> getAllTypes(java.lang.Class<? extends DBObject> clz)
Gets all the valid DBObject types for the given class, including all subclasses and implementations.


newInstance

public DBObject newInstance(java.lang.String type)
Creates a new instance of a DBObject of the given type. Returns null if a new instance cannot be instantiated - for example some types are defined at the interface level and therefore cannot be instantiated.

Parameters:
type - the object type required ( e.g. "TABLE" )
Returns:
a new DBObject of the given type

getSupportedProperties

public java.util.Collection<java.lang.String> getSupportedProperties(java.lang.Class<? extends DBObject> objClz,
                                                                     java.lang.Class<? extends DBObjectProvider> proClz)
Gets the supported properties, both defined on the bean class and also any extra properties registered via annotations or extensions, for the given object class in the context of the given provider class.

Parameters:
objClz - the object to query the properties for - cannot be null.
proClz - the provider class for the object - can be null if all registered properties are required.
Returns:
a list of the supported properties.

registerProperty

public void registerProperty(java.lang.String name,
                             java.lang.Class returnType,
                             java.lang.Class<? extends DBObjectProvider> providerType,
                             java.lang.Class<? extends DBObject>... objectTypes)
Registers a new property in the APIs metadata for a given object class and provider. Any property registered here is expected to be used in the properties Map of the given DBObject implementation(s).

Parameters:
name - the property name
returnType - the expected return type for the property
providerType - the class of DBObjectProvider that this property is to be registered against (null or DBObjectProvider.class registers for all providers).
objectTypes - the object types this property is valid against (null or DBObject.class registers for all DBObjects).

isRealBean

public static boolean isRealBean(java.lang.Class<? extends Copyable> clz)
Tests whether the given bean class is a concrete bean - i.e. not an interface or abstract class.

Parameters:
clz - the class to test
Returns:
true if it is a real, instantiable bean

getType

public static java.lang.String getType(java.lang.Class<? extends DBObject> objClass)
Returns the type defined for the given object class.

Parameters:
objClass - the class to lookup (e.g. Table.class)
Returns:
the type string for that object class (e.g. "TABLE")

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.