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>
attributes
protected String
className
protected DataMap
dataMap
-
Constructor Summary
Constructors Constructor Description Embeddable()
Embeddable(String className)
-
Method Summary
Modifier and Type Method Description <T> T
acceptVisitor(ConfigurationNodeVisitor<T> visitor)
void
addAttribute(EmbeddableAttribute attribute)
Adds new embeddable attribute to the entity, setting its parent embeddable to be this object.void
encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)
XMLSerializable
implementation that generates XML for embeddable.EmbeddableAttribute
getAttribute(String name)
EmbeddableAttribute
getAttributeForDbPath(String dbPath)
Returns EmbeddableAttribute of this Embeddable that maps todbAttribute
parameter.Map<String,EmbeddableAttribute>
getAttributeMap()
Returns an unmodifiable sorted map of embeddable attributes.Collection<EmbeddableAttribute>
getAttributes()
Returns an unmodifiable collection of embeddable attributes.String
getClassName()
DataMap
getDataMap()
void
removeAttribute(String name)
void
setClassName(String className)
void
setDataMap(DataMap dataMap)
-
Field Details
-
className
-
attributes
-
dataMap
-
-
Constructor Details
-
Embeddable
public Embeddable() -
Embeddable
-
-
Method Details
-
acceptVisitor
- Specified by:
acceptVisitor
in interfaceConfigurationNode
- Since:
- 3.1
-
getDataMap
-
setDataMap
-
getAttributeForDbPath
Returns EmbeddableAttribute of this Embeddable that maps todbAttribute
parameter. Returns null if no such attribute is found. -
getAttributeMap
Returns an unmodifiable sorted map of embeddable attributes. -
getAttributes
Returns an unmodifiable collection of embeddable attributes. -
addAttribute
Adds new embeddable attribute to the entity, setting its parent embeddable to be this object. If attribute has no name, IllegalArgumentException is thrown. -
getAttribute
-
removeAttribute
-
getClassName
-
setClassName
-
encodeAsXML
XMLSerializable
implementation that generates XML for embeddable.- Specified by:
encodeAsXML
in interfaceXMLSerializable
-