1 21 package oracle.toplink.essentials.internal.ejb.cmp3.xml.columns; 23 24 import java.lang.reflect.AnnotatedElement ; 25 26 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataColumn; 27 28 import oracle.toplink.essentials.internal.ejb.cmp3.xml.accessors.XMLBasicAccessor; 29 30 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLConstants; 31 import oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper; 32 33 import org.w3c.dom.Node ; 34 35 41 public class XMLColumn extends MetadataColumn { 42 48 public XMLColumn(Node node, XMLHelper helper, AnnotatedElement annotatedElement) { 49 super(helper.getNodeValue(node, XMLConstants.ATT_NAME), annotatedElement); 50 51 processColumnNode(helper.getNode(node, XMLConstants.COLUMN), helper); 52 } 53 54 59 public XMLColumn(Node node, XMLHelper helper, XMLBasicAccessor accessor) { 60 super(accessor.getAttributeName(), accessor.getAnnotatedElement()); 61 62 processColumnNode(node, helper); 63 } 64 65 68 public boolean loadedFromXML() { 69 return true; 70 } 71 72 75 protected void processColumnNode(Node node, XMLHelper helper) { 76 if (node != null) { 77 m_databaseField.setName(helper.getNodeValue(node, XMLConstants.ATT_NAME, DEFAULT_NAME)); 79 80 m_databaseField.setTableName(helper.getNodeValue(node, XMLConstants.ATT_TABLE, DEFAULT_TABLE)); 82 83 m_databaseField.setInsertable(helper.getNodeValue(node, XMLConstants.ATT_INSERTABLE, DEFAULT_INSERTABLE)); 85 86 m_databaseField.setUpdatable(helper.getNodeValue(node, XMLConstants.ATT_UPDATABLE, DEFAULT_UPDATABLE)); 88 89 m_databaseField.setUnique(helper.getNodeValue(node, XMLConstants.ATT_UNIQUE, DEFAULT_UNIQUE)); 91 92 m_databaseField.setNullable(helper.getNodeValue(node, XMLConstants.ATT_NULLABLE, DEFAULT_NULLABLE)); 94 95 m_databaseField.setColumnDefinition(helper.getNodeValue(node, XMLConstants.ATT_COLUMN_DEFINITION, DEFAULT_COLUMN_DEFINITION)); 97 98 m_databaseField.setLength(helper.getNodeValue(node, XMLConstants.ATT_LENGTH, DEFAULT_LENGTH)); 100 101 m_databaseField.setPrecision(helper.getNodeValue(node, XMLConstants.ATT_PRECISION, DEFAULT_PRECISION)); 103 104 m_databaseField.setScale(helper.getNodeValue(node, XMLConstants.ATT_SCALE, DEFAULT_SCALE)); 106 } 107 } 108 } 109 | Popular Tags |