1 19 package org.apache.cayenne.map; 20 21 import java.io.Serializable ; 22 23 import org.apache.cayenne.util.Util; 24 import org.apache.cayenne.util.XMLEncoder; 25 import org.apache.cayenne.util.XMLSerializable; 26 27 33 public class EmbeddableAttribute implements XMLSerializable, Serializable { 34 35 protected String name; 36 protected String type; 37 protected String dbAttributeName; 38 39 protected Embeddable embeddable; 40 41 public EmbeddableAttribute() { 42 43 } 44 45 public EmbeddableAttribute(String name) { 46 this.name = name; 47 } 48 49 public void encodeAsXML(XMLEncoder encoder) { 50 encoder.print("<embeddable-attribute name=\"" + getName() + '\"'); 51 52 if (getType() != null) { 53 encoder.print(" type=\""); 54 encoder.print(getType()); 55 encoder.print('\"'); 56 } 57 58 if (dbAttributeName != null) { 60 encoder.print(" db-attribute-name=\""); 61 encoder.print(Util.encodeXmlAttribute(dbAttributeName)); 62 encoder.print('\"'); 63 } 64 65 encoder.println("/>"); 66 } 67 68 public String getDbAttributeName() { 69 return dbAttributeName; 70 } 71 72 public void setDbAttributeName(String dbAttributeName) { 73 this.dbAttributeName = dbAttributeName; 74 } 75 76 public String getName() { 77 return name; 78 } 79 80 public void setName(String name) { 81 this.name = name; 82 } 83 84 public String getType() { 85 return type; 86 } 87 88 public void setType(String type) { 89 this.type = type; 90 } 91 92 public Embeddable getEmbeddable() { 93 return embeddable; 94 } 95 96 public void setEmbeddable(Embeddable embeddable) { 97 this.embeddable = embeddable; 98 } 99 } 100 | Popular Tags |