1 10 11 package com.triactive.jdo.model; 12 13 import java.util.List ; 14 import java.util.Set ; 15 import javax.jdo.JDOFatalInternalException; 16 import org.w3c.dom.Element ; 17 18 19 public class ArrayMetaData extends MetaData 20 { 21 protected final Class elementType; 22 protected final boolean embeddedElement; 23 24 public ArrayMetaData(FieldMetaData fmd, Element elem) 25 { 26 super(fmd.getClassMetaData().getSourceURL(), elem); 27 28 elementType = fmd.getType().getComponentType(); 29 30 String embeddedAttr = elem.getAttribute("embedded-element"); 31 32 if (embeddedAttr.length() > 0) 33 embeddedElement = Boolean.valueOf(embeddedAttr).booleanValue(); 34 else 35 embeddedElement = Types.isDefaultEmbeddedType(elementType); 36 } 37 38 public String getJavaName() 39 { 40 throw new JDOFatalInternalException("ArrayMetaData has no equivalent Java identifier"); 41 } 42 43 public Class getElementType() 44 { 45 return elementType; 46 } 47 48 public boolean isEmbeddedElement() 49 { 50 return embeddedElement; 51 } 52 53 public ColumnOptions getElementColumnOptions() 54 { 55 return new ColumnOptions() 56 { 57 public String getLength() 58 { 59 return getVendorExtension(MY_VENDOR, "length"); 60 } 61 62 public String getPrecision() 63 { 64 return getVendorExtension(MY_VENDOR, "precision"); 65 } 66 67 public String getScale() 68 { 69 return getVendorExtension(MY_VENDOR, "scale"); 70 } 71 }; 72 } 73 74 void getReferencedClasses(String vendorID, List ordered, Set referenced) 75 { 76 ClassMetaData cmd = ClassMetaData.forClass(elementType); 77 78 if (cmd != null) 79 cmd.getReferencedClasses(vendorID, ordered, referenced); 80 } 81 } 82 | Popular Tags |