public final class Metadata
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<java.lang.Class<? extends DBObject>> |
getAllDBObjectClasses()
Gets all DBObject classes that are registered with the metadata (that
is, those that have an associated type String).
|
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.Class<? extends DBObject>> |
getOwnerClasses(java.lang.Class<? extends DBObject> childClz)
Gets the classes of all objects that can own a child of the given
class.
|
java.util.Collection<java.lang.String> |
getOwnerTypes(java.lang.String childType)
Gets the object types of all objects that can own a child of the given
type.
|
java.util.Collection<java.lang.String> |
getSupportedProperties(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz)
|
java.util.Collection<java.lang.String> |
getSupportedProperties(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz,
boolean incBean,
boolean incExtra)
|
static java.lang.String |
getType(java.lang.Class<? extends DBObject> objClass)
Returns the type defined for the given object class.
|
boolean |
hasSupportedProperty(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz,
java.util.function.Predicate<PropertyInfo> predicate)
Checks whether any property matches the given criteria.
|
boolean |
isBeanProperty(java.lang.Class<? extends DBObject> clz,
java.lang.String propName)
Tests whether a given property is a bean property (i.e.
|
static boolean |
isRealBean(java.lang.Class<?> 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 |
isStaticReferenceProperty(java.lang.String propName)
Tests whether the given property name is a static reference property, i.e.
|
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 |
registerBooleanProperty(java.lang.String name,
Nullable.NullBehaviour nullBehaviour,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
Registers a new Boolean property in the APIs metadata for a given
object class and provider.
|
void |
registerIDProperty(java.lang.String name,
boolean staticReference,
java.lang.Class<? extends DBObject> referencedClass,
java.lang.String[] referencedTypes,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
Registers a new property in the APIs metadata that has a return type of
DBObjectID.
|
void |
registerIDProperty(java.lang.String name,
boolean staticReference,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
Registers a new property in the APIs metadata that has a return type of
DBObjectID.
|
void |
registerObjectClass(java.lang.String type,
java.lang.Class<? extends DBObject> clz)
Registers a new object type with its corresponding DBObject
implementation.
|
void |
registerObjectClass(java.lang.String type,
Thunk<java.lang.Class<? extends DBObject>> clzThunk)
Registers a new object type with its corresponding DBObject
implementation.
|
void |
registerProperties(java.lang.Iterable<? extends PropertyInfo> infos)
Registers extra properties into the API metadata.
|
void |
registerProperty(PropertyInfo info)
Registers an extra property into the API metadata.
|
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.
|
void |
registerStringProperty(java.lang.String name,
boolean isMultiLine,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
Registers a new property in the APIs metadata that has a return type of
String.
|
public static Metadata getInstance()
public java.util.Collection<java.lang.Class<? extends DBObject>> getAllDBObjectClasses()
public java.util.Map<java.lang.String,java.lang.Class<? extends DBObject>> getDBObjectClasses()
public boolean isSchemaObject(java.lang.String type)
isTypeOf( SchemaObject.class, type )public boolean isTypeOf(java.lang.Class<? extends DBObject> clz, java.lang.String type)
boolean isRelation = Metadata.getInstance().isTypeOf( Relation.class, type );
clz - the class to query (e.g. SystemObject.class)type - the database object type (e.g. Table.TYPE )public DBObject newDBObject(java.lang.String type, java.lang.String name)
type - the type of object to createname - the name to give the object (optional)public java.lang.Class<? extends DBObject> getObjectClass(java.lang.String type)
type - the object type to lookuppublic void registerObjectClass(java.lang.String type,
Thunk<java.lang.Class<? extends DBObject>> clzThunk)
public void registerObjectClass(java.lang.String type,
java.lang.Class<? extends DBObject> clz)
public java.util.Collection<java.lang.String> getAllTypes(java.lang.Class<? extends DBObject> clz)
public DBObject newInstance(java.lang.String type)
null if a new instance cannot be instantiated - for example
some types are defined at the interface level and therefore cannot be
instantiated.type - the object type required ( e.g. "TABLE" )@Deprecated
public java.util.Collection<java.lang.String> getSupportedProperties(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz)
@Deprecated
public java.util.Collection<java.lang.String> getSupportedProperties(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz,
boolean incBean,
boolean incExtra)
public boolean hasSupportedProperty(java.lang.Class<?> objClz,
java.lang.Class<? extends DBObjectProvider> proClz,
java.util.function.Predicate<PropertyInfo> predicate)
#getSupportedPropertiesMaps but stops when a
property matches (thereby avoiding unnecessary property loading).
An example use would be to check whether a given object class has any extra properties.
objClz - the object class to query - must not be null.proClz - the provider class to query - can be null.predicate - the test that at least one PropertyInfo must pass
(for example a PropertyCriteria) - must not be null.public void registerProperty(java.lang.String name,
java.lang.Class returnType,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
name - the property namereturnType - the expected return type for the propertyproviderType - 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).public void registerBooleanProperty(java.lang.String name,
Nullable.NullBehaviour nullBehaviour,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
name - the property namenullBehaviour - the behaviour of the property regarding null as
an allowed valueproviderType - 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).public void registerStringProperty(java.lang.String name,
boolean isMultiLine,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
name - the property nameisMultiLine - wher the String can contain newlinesproviderType - 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).public void registerIDProperty(java.lang.String name,
boolean staticReference,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
name - the property namestaticReference - true if the property value is treated as a normal
reference and replaced by the replaceReferenceIDs method on DBObject.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).public void registerIDProperty(java.lang.String name,
boolean staticReference,
java.lang.Class<? extends DBObject> referencedClass,
java.lang.String[] referencedTypes,
java.lang.Class<? extends DBObjectProvider> providerType,
java.lang.Class<? extends DBObject>... objectTypes)
name - the property namestaticReference - true if the property value is treated as a normal
reference and replaced by the replaceReferenceIDs method on DBObject.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).public void registerProperty(PropertyInfo info)
java.lang.IllegalArgumentException - if the PropertyInfo is not valid or a
property is already registered with that name.public void registerProperties(java.lang.Iterable<? extends PropertyInfo> infos)
public boolean isStaticReferenceProperty(java.lang.String propName)
propName - the name of the property to querypublic boolean isBeanProperty(java.lang.Class<? extends DBObject> clz, java.lang.String propName)
clz - the object type to testpropName - the property name to findpublic java.util.Collection<java.lang.String> getOwnerTypes(java.lang.String childType)
childType - the child type to lookupgetOwnerClasses(java.lang.Class<? extends oracle.javatools.db.DBObject>)public java.util.Collection<java.lang.Class<? extends DBObject>> getOwnerClasses(java.lang.Class<? extends DBObject> childClz)
childClz - the child class to lookupgetOwnerTypes(java.lang.String)public static boolean isRealBean(java.lang.Class<?> clz)
clz - the class to test