Package org.apache.cayenne.map
Class EmbeddedAttribute
- java.lang.Object
-
- org.apache.cayenne.map.Attribute
-
- org.apache.cayenne.map.ObjAttribute
-
- org.apache.cayenne.map.EmbeddedAttribute
-
- All Implemented Interfaces:
Serializable
,ConfigurationNode
,CayenneMapEntry
,XMLSerializable
public class EmbeddedAttribute extends ObjAttribute
An attribute of the ObjEntity that maps to an embeddable class.- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>
attributeOverrides
-
Fields inherited from class org.apache.cayenne.map.ObjAttribute
dbAttributePath, lazy, type, usedForLocking
-
-
Constructor Summary
Constructors Constructor Description EmbeddedAttribute()
EmbeddedAttribute(String name)
EmbeddedAttribute(String name, String type, ObjEntity entity)
EmbeddedAttribute(EmbeddedAttribute other)
Copying constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeOverride(String name, String dbAttributeName)
void
encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)
Prints itself as XML to the provided XMLEncoder.ObjAttribute
getAttribute(String name)
Returns an ObjAttribute for a given name, taking into account column name overrides.ObjAttribute
getAttributeForDbPath(String dbPath)
Returns an ObjAttribute that maps to a givenDbAttribute
, or returns null if no such attribute exists.Map<String,String>
getAttributeOverrides()
Collection<ObjAttribute>
getAttributes()
Returns a Collection of ObjAttributes of an embedded object taking into account column name overrides.Embeddable
getEmbeddable()
Class<?>
getJavaClass()
Returns Java class of an object property described by this attribute.String
getType()
Returns a type of this attribute that must be anEmbeddable
object.void
removeAttributeOverride(String name)
void
setType(String type)
Sets a type of this attribute that must be anEmbeddable
object.-
Methods inherited from class org.apache.cayenne.map.ObjAttribute
acceptVisitor, getClientAttribute, getDbAttribute, getDbAttributeName, getDbAttributePath, getDbPathIterator, getDbPathIterator, getEntity, getMaxLength, isFlattened, isInherited, isLazy, isMandatory, isPrimaryKey, isUsedForLocking, setDbAttributePath, setLazy, setUsedForLocking, toString, updateDbAttributePath
-
-
-
-
Constructor Detail
-
EmbeddedAttribute
public EmbeddedAttribute()
-
EmbeddedAttribute
public EmbeddedAttribute(String name)
-
EmbeddedAttribute
public EmbeddedAttribute(EmbeddedAttribute other)
Copying constructor- Parameters:
other
- attribute to copy- Since:
- 4.2
-
-
Method Detail
-
encodeAsXML
public void encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)
Description copied from class:ObjAttribute
Prints itself as XML to the provided XMLEncoder.- Specified by:
encodeAsXML
in interfaceXMLSerializable
- Overrides:
encodeAsXML
in classObjAttribute
-
getEmbeddable
public Embeddable getEmbeddable()
-
getAttributeForDbPath
public ObjAttribute getAttributeForDbPath(String dbPath)
Returns an ObjAttribute that maps to a givenDbAttribute
, or returns null if no such attribute exists.
-
getAttribute
public ObjAttribute getAttribute(String name)
Returns an ObjAttribute for a given name, taking into account column name overrides.
-
getAttributes
public Collection<ObjAttribute> getAttributes()
Returns a Collection of ObjAttributes of an embedded object taking into account column name overrides.
-
removeAttributeOverride
public void removeAttributeOverride(String name)
-
getType
public String getType()
Returns a type of this attribute that must be anEmbeddable
object.- Overrides:
getType
in classObjAttribute
-
getJavaClass
public Class<?> getJavaClass()
Returns Java class of an object property described by this attribute. Wraps any thrown exceptions into CayenneRuntimeException.- Overrides:
getJavaClass
in classObjAttribute
-
setType
public void setType(String type)
Sets a type of this attribute that must be anEmbeddable
object.- Overrides:
setType
in classObjAttribute
-
-