1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects; 23 24 import java.lang.reflect.Type ; 25 import java.lang.reflect.AnnotatedElement ; 26 27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataHelper; 28 29 36 public abstract class MetadataAccessibleObject { 37 private String m_name; 38 private Class m_rawClass; 39 private Type m_relationType; 40 private String m_attributeName; 41 private Class m_referenceClass; 42 private AnnotatedElement m_annotatedElement; 43 44 47 public MetadataAccessibleObject(AnnotatedElement annotatedElement) { 48 m_annotatedElement = annotatedElement; 49 } 50 51 55 public AnnotatedElement getAnnotatedElement() { 56 return m_annotatedElement; 57 } 58 59 63 public String getAttributeName() { 64 return m_attributeName; 65 } 66 67 71 public String getName() { 72 return m_name; 73 } 74 75 81 public Class getRawClass() { 82 if (m_rawClass == null) { 83 if (MetadataHelper.isGenericCollectionType(m_relationType)) { 84 m_rawClass = MetadataHelper.getRawClassFromGeneric(m_relationType); 88 } else { 89 m_rawClass = (Class ) m_relationType; 90 } 91 } 92 93 return m_rawClass; 94 } 95 96 100 public Class getReferenceClass() { 101 if (m_referenceClass == null) { 102 if (MetadataHelper.isGenericCollectionType(m_relationType)) { 103 m_referenceClass = MetadataHelper.getReturnTypeFromGeneric(m_relationType); 107 } else { 108 m_referenceClass = (Class ) m_relationType; 109 } 110 } 111 112 return m_referenceClass; 113 } 114 115 119 public Type getRelationType() { 120 return m_relationType; 121 } 122 123 129 public void setAnnotatedElement(AnnotatedElement annotatedElement) { 130 m_annotatedElement = annotatedElement; 131 } 132 133 137 protected void setAttributeName(String attributeName) { 138 m_attributeName = attributeName; 139 } 140 141 145 protected void setName(String name) { 146 m_name = name; 147 } 148 149 153 public void setReferenceClass(Class referenceClass) { 154 m_referenceClass = referenceClass; 155 } 156 157 161 protected void setRelationType(Type relationType) { 162 m_relationType = relationType; 163 } 164 } 165 | Popular Tags |