FileDocCategorySizeDatePackage
MetadataAccessibleObject.javaAPI DocGlassfish v2 API6557Tue May 22 16:54:26 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects

MetadataAccessibleObject

public abstract class MetadataAccessibleObject extends Object
Parent object that is used to hold onto a valid EJB 3.0 decorated method or field.
author
Guy Pelletier
since
TopLink 10.1.3/EJB 3.0 Preview

Fields Summary
private String
m_name
private Class
m_rawClass
private Type
m_relationType
private String
m_attributeName
private AnnotatedElement
m_annotatedElement
Constructors Summary
public MetadataAccessibleObject(AnnotatedElement annotatedElement)
INTERNAL:

        m_annotatedElement = annotatedElement;   
    
Methods Summary
public java.lang.reflect.AnnotatedElementgetAnnotatedElement()
INTERNAL: Return the actual field or method.

        return m_annotatedElement;
    
public java.lang.StringgetAttributeName()
INTERNAL: Set the relation type of this accessible object.

        return m_attributeName;
    
public java.lang.ClassgetMapKeyClass()
INTERNAL: This should only be called for accessor's of type Map. It will return the Map key type if generics are used, null otherwise.

        if (MetadataHelper.isGenericCollectionType(m_relationType)) {
            // By default, the reference class is equal to the relation
            // class. But if the relation class is a generic we need to 
            // extract and set the actual reference class from the generic. 
            return MetadataHelper.getMapKeyTypeFromGeneric(m_relationType);
        } else {
            return null;
        }
    
public java.lang.StringgetName()
INTERNAL: Set the relation type of this accessible object.

        return m_name;
    
public java.lang.ClassgetRawClass()
INTERNAL: Return the raw class for this accessible object. E.g. For an accessible object with a type of java.util.Collection, this method will return java.util.Collection.

See
getReferenceClassFromGeneric() to get Employee.class back.

        if (m_rawClass == null) {
            if (MetadataHelper.isGenericCollectionType(m_relationType)) {
                // By default, the raw class is equal to the relation
                // class. But if the relation class is a generic we need to 
                // extract and set the actual raw class from the generic. 
                m_rawClass = MetadataHelper.getRawClassFromGeneric(m_relationType);
            } else {
                m_rawClass = (Class) m_relationType;
            }
        }
        
        return m_rawClass;
    
public java.lang.ClassgetReferenceClassFromGeneric()
INTERNAL: Return the reference class from the generic specification on this accessible object. Here is what you will get back from this method given the following scenarios: 1 - public Collection getTasks() => String.class 2 - public Map getTasks() => Integer.class 3 - public Employee getEmployee() => null 4 - public Collection getTasks() => null 5 - public Map getTasks() => null

        if (MetadataHelper.isGenericCollectionType(m_relationType)) {
            return MetadataHelper.getReturnTypeFromGeneric(m_relationType);
        } else {
            return null;
        }
    
public java.lang.reflect.TypegetRelationType()
INTERNAL: Return the relation type of this accessible object.

        return m_relationType;
    
public voidsetAnnotatedElement(java.lang.reflect.AnnotatedElement annotatedElement)
INTERNAL: Set the annotated element for this accessible object. Once the class loader changes, we need to be able to update our classes.

        m_annotatedElement = annotatedElement;
    
protected voidsetAttributeName(java.lang.String attributeName)
INTERNAL: Set the relation type of this accessible object.

        m_attributeName = attributeName;
    
protected voidsetName(java.lang.String name)
INTERNAL: Set the relation type of this accessible object.

        m_name = name;
    
protected voidsetRelationType(java.lang.reflect.Type relationType)
INTERNAL: Set the relation type of this accessible object.

        m_relationType = relationType;