Methods Summary |
---|
private oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptor(java.lang.Object type)Returns the class descriptor if the specified non-null type is a class
object.
ClassDescriptor desc = null;
if (type instanceof Class) {
desc = session.getDescriptor((Class)type);
} else if (type instanceof ClassDescriptor) {
desc = (ClassDescriptor)type;
}
return desc;
|
private java.lang.Object | getType(oracle.toplink.essentials.mappings.DatabaseMapping mapping)
if (mapping == null) {
return null;
}
Object type = null;
if (mapping.isForeignReferenceMapping()) {
ClassDescriptor descriptor = mapping.getReferenceDescriptor();
type = descriptor == null ? null : descriptor.getJavaClass();
} else if (mapping.isAggregateMapping()) {
// Return the ClassDescriptor as the type representation in case
// of an embeeded. This makese sure that any property or field
// access of the embedded uses the correct mapping information and
// not the shell of the descriptors as stored by the session.
type = ((AggregateMapping)mapping).getReferenceDescriptor();
} else {
type = mapping.getAttributeClassification();
}
return type;
|
public boolean | isCollectionValuedRelationship(java.lang.Object ownerClass, java.lang.String attribute)Returns true if the specified attribute denotes a collection valued
relationship attribute.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return (mapping != null) &&
(mapping.isOneToManyMapping() || mapping.isManyToManyMapping());
|
public boolean | isEmbeddable(java.lang.Object type)Returns true if the specified type denotes an embedded class.
ClassDescriptor desc = getDescriptor(type);
return (desc != null) && desc.isAggregateDescriptor();
|
public boolean | isEmbeddedAttribute(java.lang.Object ownerClass, java.lang.String attribute)Returns true if the specified type denotes an embedded attribute.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return (mapping != null) && mapping.isAggregateMapping();
|
public boolean | isEntityClass(java.lang.Object type)Returns true if the specified type denotes an entity class.
ClassDescriptor desc = getDescriptor(type);
return (desc != null) && !desc.isAggregateDescriptor();
|
public boolean | isRelationship(java.lang.Object ownerClass, java.lang.String attribute)Returns true if the specified attribute denotes a single valued
or collection valued relationship attribute.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return (mapping != null) &&
(mapping.isObjectReferenceMapping() ||
mapping.isOneToManyMapping() ||
mapping.isManyToManyMapping());
|
public boolean | isSimpleStateAttribute(java.lang.Object ownerClass, java.lang.String attribute)Returns true if the specified type denotes a simple state attribute.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return (mapping != null) && mapping.isDirectToFieldMapping();
|
public boolean | isSingleValuedRelationship(java.lang.Object ownerClass, java.lang.String attribute)Returns true if the specified attribute denotes a single valued
relationship attribute.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return (mapping != null) && mapping.isObjectReferenceMapping();
|
public java.lang.Object | resolveAttribute(java.lang.Object ownerClass, java.lang.String attribute)Returns the type of the attribute with the specified name in the
specified owner class.
DatabaseMapping mapping =
resolveAttributeMapping(ownerClass, attribute);
return getType(mapping);
|
private oracle.toplink.essentials.mappings.DatabaseMapping | resolveAttributeMapping(java.lang.Object ownerClass, java.lang.String attr)Returns the mapping for the specified attribute of the psecified
class. The method returns null if the class is not known or if the
class does not have an attribute of the specified name.
ClassDescriptor desc = getDescriptor(ownerClass);
return (desc == null) ? null : desc.getMappingForAttributeName(attr);
|
public java.lang.Object | resolveEnumConstant(java.lang.Object type, java.lang.String constant)Returns the enum constant if the specified type denotes an enum type
and the specified constant denotes a constant of the enum type.
Class clazz = getJavaClass(type);
Object[] constants = clazz.getEnumConstants();
if (constants != null) {
for (int i = 0; i < constants.length; i++) {
if (constant.equals(constants[i].toString())) {
return constants[i];
}
}
}
return null;
|
public java.lang.Object | resolveSchema(java.lang.String schemaName)Returns the type of the class corresponding to the spcified abstract
schema type.
ClassDescriptor descriptor = session.getDescriptorForAlias(schemaName);
return (descriptor != null) ? descriptor.getJavaClass() : null;
|
public java.lang.Object | resolveTypeName(java.lang.String typeName)Returns a type representation for the specified type name or null if
there is no such type.
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Class)AccessController.doPrivileged(
new PrivilegedClassForName(typeName, true, classLoader));
} catch (PrivilegedActionException exception) {
return null;
}
} else {
return PrivilegedAccessHelper.getClassForName(typeName, true, classLoader);
}
} catch (ClassNotFoundException ex) {
return null;
}
|