Methods Summary |
---|
public java.lang.reflect.AnnotatedElement | getAnnotatedElement()INTERNAL:
Return the annotated element for this accessor.
return m_accessibleObject.getAnnotatedElement();
|
protected T | getAnnotation(java.lang.Class annotation)INTERNAL:
Return the annotated element for this accessor.
return (T) getAnnotation(annotation, getAnnotatedElement());
|
protected T | getAnnotation(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement)INTERNAL:
Return the annotated element for this accessor.
return (T) MetadataHelper.getAnnotation(annotation, annotatedElement, m_descriptor);
|
public java.lang.String | getAttributeName()INTERNAL:
Return the attribute name for this accessor.
return m_accessibleObject.getAttributeName();
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor | getDescriptor()INTERNAL:
Return the MetadataDescriptor for this accessor.
return m_descriptor;
|
public java.lang.String | getFetchType()INTERNAL:
Subclasses that support processing a fetch type should override this
method, otherwise a runtime development exception is thrown for those
accessors who call this method and don't implement it themselves.
throw new RuntimeException("Development exception. The accessor: [" + this + "] should not call the getFetchType method unless it overrides it.");
|
public java.lang.Class | getJavaClass()INTERNAL: (Overridden in ClassAccessor)
Return the java class associated with this accessor's descriptor.
return m_descriptor.getJavaClass();
|
protected java.lang.String | getJavaClassName()INTERNAL:
Return the java class that defines this accessor.
return getJavaClass().getName();
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataLogger | getLogger()INTERNAL:
Return the metadata validator.
return m_logger;
|
protected java.lang.Class | getMapKeyClass()INTERNAL:
Return the map key class from a generic Map type. If it is not generic,
then null is returned.
return m_accessibleObject.getMapKeyClass();
|
public java.lang.String | getName()INTERNAL:
Returns the name of this accessor. If it is a field, it will return
the field name. For a method it will return the method name.
return m_accessibleObject.getName();
|
protected java.lang.String | getName(oracle.toplink.essentials.internal.helper.DatabaseField field, java.lang.String defaultName, java.lang.String context)INTERNAL:
Helper method to return a field name from a candidate field name and a
default field name.
Requires the context from where this method is called to output the
correct logging message when defaulting the field name.
return getName(field.getName(), defaultName, context);
|
protected java.lang.String | getName(java.lang.String name, java.lang.String defaultName, java.lang.String context)INTERNAL:
Helper method to return a field name from a candidate field name and a
default field name.
Requires the context from where this method is called to output the
correct logging message when defaulting the field name.
In some cases, both the name and defaultName could be "" or null,
therefore, don't log any message and return name.
// Check if a candidate was specified otherwise use the default.
if (name != null && !name.equals("")) {
return name;
} else if (defaultName == null || defaultName.equals("")) {
return "";
} else {
// Log the defaulting field name based on the given context.
m_logger.logConfigMessage(context, getAnnotatedElement(), defaultName);
return defaultName;
}
|
protected oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataPrimaryKeyJoinColumns | getPrimaryKeyJoinColumns(java.lang.String sourceTableName, java.lang.String targetTableName)INTERNAL: (Overridden in XMLClassAccessor and XMLOneToOneAccessor)
Process the @PrimaryKeyJoinColumns and @PrimaryKeyJoinColumn.
PrimaryKeyJoinColumn primaryKeyJoinColumn = getAnnotation(PrimaryKeyJoinColumn.class);
PrimaryKeyJoinColumns primaryKeyJoinColumns = getAnnotation(PrimaryKeyJoinColumns.class);
return new MetadataPrimaryKeyJoinColumns(primaryKeyJoinColumns, primaryKeyJoinColumn, sourceTableName, targetTableName);
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor | getProcessor()INTERNAL:
Return the MetadataProcessor.
return m_processor;
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject | getProject()INTERNAL:
Return the MetadataProject.
return m_project;
|
public java.lang.Class | getRawClass()INTERNAL:
Return the raw class for this accessor.
Eg. For an accessor with a type of java.util.Collection, this
method will return java.util.Collection
return m_accessibleObject.getRawClass();
|
public java.lang.Class | getReferenceClass()INTERNAL: (Overridden in CollectionAccessor and ObjectAccessor)
Return the reference class for this accessor. By default the reference
class is the raw class. Some accessors, namely relationship accessors,
will need to override this behavior to extract a reference class from
generics or a target entity specification.
return m_accessibleObject.getRawClass();
|
public java.lang.String | getReferenceClassName()INTERNAL:
Return the reference class name for this accessor.
return getReferenceClass().getName();
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor | getReferenceDescriptor()INTERNAL:
Return the reference metadata descriptor for this accessor.
return m_project.getDescriptor(getReferenceClass());
|
protected java.lang.reflect.Type | getRelationType()INTERNAL:
Return the relation type of this accessor.
return m_accessibleObject.getRelationType();
|
protected java.lang.String | getSetMethodName()INTERNAL:
Returns the set method name of a method accessor. Note, this method
should not be called when processing field access.
return ((MetadataMethod) m_accessibleObject).getSetMethodName();
|
protected java.lang.String | getUpperCaseAttributeName()INTERNAL:
Return the upper cased attribute name for this accessor. Used when
defaulting.
return getAttributeName().toUpperCase();
|
protected java.lang.String | getUpperCaseShortJavaClassName()INTERNAL:
Return the upper case java class that defines this accessor.
return Helper.getShortClassName(getJavaClassName()).toUpperCase();
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator | getValidator()INTERNAL:
Return the metadata validator.
return m_validator;
|
protected boolean | hasColumn()INTERNAL:
Method to check if an annotated element has a @Column.
return isAnnotationPresent(Column.class);
|
protected boolean | hasPrimaryKeyJoinColumns()INTERNAL:
Method to check if this accessor has @PrimaryKeyJoinColumns.
return isAnnotationPresent(PrimaryKeyJoinColumns.class);
|
protected boolean | isAnnotationPresent(java.lang.Class annotation)INTERNAL:
Indicates whether the specified annotation is present on the annotated
element for this accessor. Method checks against the metadata complete
flag.
return isAnnotationPresent(annotation, getAnnotatedElement());
|
protected boolean | isAnnotationPresent(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement)INTERNAL:
Indicates whether the specified annotation is present on the annotated
element for this accessor. Method checks against the metadata complete
flag.
return MetadataHelper.isAnnotationPresent(annotation, annotatedElement, m_descriptor);
|
public boolean | isBasic()INTERNAL:
Return true if this accessor represents a basic mapping.
return false;
|
public boolean | isClass()INTERNAL:
Return true if this accessor represents a class.
return false;
|
public boolean | isEmbedded()INTERNAL:
Return true if this accessor represents an aggregate mapping.
return false;
|
public boolean | isEmbeddedId()INTERNAL:
Return true if this accessor represents an aggregate id mapping.
return false;
|
public boolean | isManyToMany()INTERNAL:
Return true if this accessor represents a m-m relationship.
return false;
|
public boolean | isManyToOne()INTERNAL:
Return true if this accessor represents a m-1 relationship.
return false;
|
public boolean | isOneToMany()INTERNAL:
Return true if this accessor represents a 1-m relationship.
return false;
|
public boolean | isOneToOne()INTERNAL:
Return true if this accessor represents a 1-1 relationship.
return false;
|
public boolean | isOptional()INTERNAL:
Subclasses that support processing an optional setting should override
this method, otherwise a runtime development exception is thrown for
those accessors who call this method and don't implement it themselves.
throw new RuntimeException("Development exception. The accessor: [" + this + "] should not call the isOptional method unless it overrides it.");
|
public boolean | isProcessed()INTERNAL:
Return true if this accessor has already been processed.
return m_isProcessed;
|
public boolean | isRelationship()INTERNAL:
Return true if this accessor method represents a relationship. It will
cache the boolean value to avoid multiple checks and validation.
if (m_isRelationship == null) {
m_isRelationship = new Boolean(isManyToOne() || isManyToMany() || isOneToMany() || isOneToOne());
}
return m_isRelationship.booleanValue();
|
public boolean | isXMLAccessor()INTERNAL:
Return true if this is an XML processing accessor.
return false;
|
public abstract void | process()INTERNAL:
Every accessor knows how to process themselves since they have all the
information they need.
|
protected oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor | processAccessor(oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL: (Overidden in XMLClassAccessor and XMLEmbeddedAccessor)
Fast track processing a ClassAccessor for the given descriptor.
Inheritance root classes and embeddables may be fast tracked.
ClassAccessor accessor = new ClassAccessor(new MetadataClass(descriptor.getJavaClass()), getProcessor(), descriptor);
descriptor.setClassAccessor(accessor);
accessor.process();
return accessor;
|
protected java.util.List | processPrimaryKeyJoinColumns(oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataPrimaryKeyJoinColumns primaryKeyJoinColumns)INTERNAL:
Process the primary key join columms for this accessors annotated element.
// This call will add any defaulted columns as necessary.
List<MetadataPrimaryKeyJoinColumn> pkJoinColumns = primaryKeyJoinColumns.values(m_descriptor);
if (m_descriptor.hasCompositePrimaryKey()) {
// Validate the number of primary key fields defined.
if (pkJoinColumns.size() != m_descriptor.getPrimaryKeyFields().size()) {
m_validator.throwIncompletePrimaryKeyJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
// All the primary and foreign key field names should be specified.
for (MetadataPrimaryKeyJoinColumn pkJoinColumn : pkJoinColumns) {
if (pkJoinColumn.isPrimaryKeyFieldNotSpecified() || pkJoinColumn.isForeignKeyFieldNotSpecified()) {
m_validator.throwIncompletePrimaryKeyJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
}
} else {
if (pkJoinColumns.size() > 1) {
m_validator.throwExcessivePrimaryKeyJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
}
return pkJoinColumns;
|
protected void | processTable(oracle.toplink.essentials.internal.ejb.cmp3.metadata.tables.MetadataTable table, java.lang.String defaultName)INTERNAL:
Common table processing for table, secondary table, join table and
collection table.
// Name could be "", need to check against the default name.
String name = getName(table.getName(), defaultName, table.getNameContext());
// Catalog could be "", need to check for an XML default.
String catalog = getName(table.getCatalog(), m_descriptor.getCatalog(), table.getCatalogContext());
// Schema could be "", need to check for an XML default.
String schema = getName(table.getSchema(), m_descriptor.getSchema(), table.getSchemaContext());
// Build a fully qualified name and set it on the table.
table.setName(MetadataHelper.getFullyQualifiedTableName(name, catalog, schema));
|
protected void | setAccessorMethods(oracle.toplink.essentials.mappings.DatabaseMapping mapping)INTERNAL:
Set the getter and setter access methods for this accessor.
if (m_descriptor.usesPropertyAccess()) {
mapping.setGetMethodName(getName());
mapping.setSetMethodName(getSetMethodName());
}
|
public void | setAnnotatedElement(java.lang.reflect.AnnotatedElement annotatedElement)INTERNAL:
Return the annotated element for this accessor.
m_accessibleObject.setAnnotatedElement(annotatedElement);
|
protected void | setIndirectionPolicy(oracle.toplink.essentials.mappings.CollectionMapping mapping, java.lang.String mapKey)INTERNAL:
Set the correct indirection policy on a collection mapping. Method
assume that the reference class has been set on the mapping before
calling this method.
Class rawClass = getRawClass();
if (usesIndirection()) {
if (rawClass == Map.class) {
mapping.useTransparentMap(mapKey);
} else if (rawClass == List.class) {
mapping.useTransparentList();
} else if (rawClass == Collection.class) {
mapping.useTransparentCollection();
mapping.setContainerPolicy(new CollectionContainerPolicy(ClassConstants.IndirectList_Class));
} else if (rawClass == Set.class) {
mapping.useTransparentSet();
} else {
// Because of validation we should never get this far.
}
} else {
mapping.dontUseIndirection();
if (rawClass == Map.class) {
mapping.useMapClass(java.util.Hashtable.class, mapKey);
} else if (rawClass == Set.class) {
mapping.useCollectionClass(java.util.HashSet.class);
} else {
mapping.useCollectionClass(java.util.Vector.class);
}
}
|
public void | setIsProcessed()INTERNAL:
m_isProcessed = true;
|
public boolean | usesIndirection()INTERNAL:
return getFetchType().equals(MetadataConstants.LAZY);
|