Package org.apache.cayenne.map
Class Embeddable
- java.lang.Object
-
- org.apache.cayenne.map.Embeddable
-
- All Implemented Interfaces:
Serializable,ConfigurationNode,XMLSerializable
public class Embeddable extends Object implements ConfigurationNode, XMLSerializable, Serializable
A mapping descriptor of an embeddable class. Embeddable is a persistent class that doesn't have its own identity and is embedded in other persistent classes. It can be viewed as a custom type mapped to one or more database columns. Embeddable mapping can include optional default column names that can be overriden by the owning entity.- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,EmbeddableAttribute>attributesprotected StringclassNameprotected DataMapdataMap
-
Constructor Summary
Constructors Constructor Description Embeddable()Embeddable(String className)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TacceptVisitor(ConfigurationNodeVisitor<T> visitor)voidaddAttribute(EmbeddableAttribute attribute)Adds new embeddable attribute to the entity, setting its parent embeddable to be this object.voidencodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)XMLSerializableimplementation that generates XML for embeddable.EmbeddableAttributegetAttribute(String name)EmbeddableAttributegetAttributeForDbPath(String dbPath)Returns EmbeddableAttribute of this Embeddable that maps todbAttributeparameter.Map<String,EmbeddableAttribute>getAttributeMap()Returns an unmodifiable sorted map of embeddable attributes.Collection<EmbeddableAttribute>getAttributes()Returns an unmodifiable collection of embeddable attributes.StringgetClassName()DataMapgetDataMap()voidremoveAttribute(String name)voidsetClassName(String className)voidsetDataMap(DataMap dataMap)
-
-
-
Field Detail
-
className
protected String className
-
attributes
protected Map<String,EmbeddableAttribute> attributes
-
dataMap
protected DataMap dataMap
-
-
Constructor Detail
-
Embeddable
public Embeddable()
-
Embeddable
public Embeddable(String className)
-
-
Method Detail
-
acceptVisitor
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
- Specified by:
acceptVisitorin interfaceConfigurationNode- Since:
- 3.1
-
getDataMap
public DataMap getDataMap()
-
setDataMap
public void setDataMap(DataMap dataMap)
-
getAttributeForDbPath
public EmbeddableAttribute getAttributeForDbPath(String dbPath)
Returns EmbeddableAttribute of this Embeddable that maps todbAttributeparameter. Returns null if no such attribute is found.
-
getAttributeMap
public Map<String,EmbeddableAttribute> getAttributeMap()
Returns an unmodifiable sorted map of embeddable attributes.
-
getAttributes
public Collection<EmbeddableAttribute> getAttributes()
Returns an unmodifiable collection of embeddable attributes.
-
addAttribute
public void addAttribute(EmbeddableAttribute attribute)
Adds new embeddable attribute to the entity, setting its parent embeddable to be this object. If attribute has no name, IllegalArgumentException is thrown.
-
getAttribute
public EmbeddableAttribute getAttribute(String name)
-
removeAttribute
public void removeAttribute(String name)
-
getClassName
public String getClassName()
-
setClassName
public void setClassName(String className)
-
encodeAsXML
public void encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)
XMLSerializableimplementation that generates XML for embeddable.- Specified by:
encodeAsXMLin interfaceXMLSerializable
-
-