1 package org.apache.ojb.broker.metadata; 2 3 17 18 import org.apache.ojb.broker.metadata.fieldaccess.PersistentField; 19 import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory; 20 21 import java.io.Serializable ; 22 23 30 public class AttributeDescriptorBase extends DescriptorBase implements Serializable 31 { 32 private static final long serialVersionUID = -818671542770428043L; 33 34 protected PersistentField m_PersistentField = null; 35 protected ClassDescriptor m_ClassDescriptor = null; 36 37 40 public AttributeDescriptorBase(ClassDescriptor descriptor) 41 { 42 this.m_ClassDescriptor = descriptor; 43 } 44 45 48 public void setPersistentField(Class c, String fieldname) 49 { 50 m_PersistentField = PersistentFieldFactory.createPersistentField(c, fieldname); 51 } 52 53 public void setPersistentField(PersistentField pf) 54 { 55 m_PersistentField = pf; 56 } 57 58 61 public PersistentField getPersistentField() 62 { 63 return m_PersistentField; 64 } 65 66 69 public String getAttributeName() 70 { 71 return getPersistentField().getName(); 72 } 73 74 78 public ClassDescriptor getClassDescriptor() 79 { 80 return m_ClassDescriptor; 81 } 82 83 87 public void setClassDescriptor(ClassDescriptor classDescriptor) 88 { 89 m_ClassDescriptor = classDescriptor; 90 } 91 92 public String toString() 93 { 94 StringBuffer buf = new StringBuffer (); 95 buf.append(m_PersistentField); 96 buf.append(", field_belongs_to " + m_ClassDescriptor.getClassNameOfObject()); 97 buf.append(", "+super.toString()); 98 return buf.toString(); 99 } 100 } 101 | Popular Tags |