org.apache.cayenne.map
Class Embeddable

java.lang.Object
  extended by org.apache.cayenne.map.Embeddable
All Implemented Interfaces:
java.io.Serializable, ConfigurationNode, XMLSerializable

public class Embeddable
extends java.lang.Object
implements ConfigurationNode, XMLSerializable, java.io.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
protected  java.util.SortedMap<java.lang.String,EmbeddableAttribute> attributes
           
protected  java.lang.String className
           
protected  DataMap dataMap
           
 
Constructor Summary
Embeddable()
           
Embeddable(java.lang.String className)
           
 
Method Summary
<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)
          XMLSerializable implementation that generates XML for embeddable.
 EmbeddableAttribute getAttribute(java.lang.String name)
           
 EmbeddableAttribute getAttributeForDbPath(java.lang.String dbPath)
          Returns EmbeddableAttribute of this Embeddable that maps to dbAttribute parameter.
 java.util.SortedMap<java.lang.String,EmbeddableAttribute> getAttributeMap()
          Returns an unmodifiable sorted map of embeddable attributes.
 java.util.Collection<EmbeddableAttribute> getAttributes()
          Returns an unmodifiable collection of embeddable attributes.
 java.lang.String getClassName()
           
 DataMap getDataMap()
           
 java.lang.Class<?> getJavaClass()
          Returns Java class of the embeddable.
 void removeAttribute(java.lang.String name)
           
 void setClassName(java.lang.String className)
           
 void setDataMap(DataMap dataMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

protected java.lang.String className

attributes

protected java.util.SortedMap<java.lang.String,EmbeddableAttribute> attributes

dataMap

protected DataMap dataMap
Constructor Detail

Embeddable

public Embeddable()

Embeddable

public Embeddable(java.lang.String className)
Method Detail

acceptVisitor

public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
Specified by:
acceptVisitor in interface ConfigurationNode
Since:
3.1

getDataMap

public DataMap getDataMap()

setDataMap

public void setDataMap(DataMap dataMap)

getJavaClass

public java.lang.Class<?> getJavaClass()
Returns Java class of the embeddable.


getAttributeForDbPath

public EmbeddableAttribute getAttributeForDbPath(java.lang.String dbPath)
Returns EmbeddableAttribute of this Embeddable that maps to dbAttribute parameter. Returns null if no such attribute is found.


getAttributeMap

public java.util.SortedMap<java.lang.String,EmbeddableAttribute> getAttributeMap()
Returns an unmodifiable sorted map of embeddable attributes.


getAttributes

public java.util.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(java.lang.String name)

removeAttribute

public void removeAttribute(java.lang.String name)

getClassName

public java.lang.String getClassName()

setClassName

public void setClassName(java.lang.String className)

encodeAsXML

public void encodeAsXML(XMLEncoder encoder)
XMLSerializable implementation that generates XML for embeddable.

Specified by:
encodeAsXML in interface XMLSerializable


Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.