EmbeddedAttribute (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.map, class: EmbeddedAttribute

# Class EmbeddedAttribute

java.lang.Object
org.apache.cayenne.map.Attribute<ObjEntity, ObjAttribute, ObjRelationship>
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 ObjAttribute

  `dbAttributePath, lazy, type, usedForLocking`
  Modifier and Type
  Field
  Description
  `protected CayennePath`
  `dbAttributePath`
  `protected boolean`
  `lazy`
  `protected String`
  `type`
  `protected boolean`
  `usedForLocking`

  ### Fields inherited from class Attribute

  `entity, name`
  Modifier and Type
  Field
  Description
  `protected Entity<ObjEntity, ObjAttribute, ObjRelationship>`
  `entity`
  `protected String`
  `name`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EmbeddedAttribute()`
  `EmbeddedAttribute(String name)`
  `EmbeddedAttribute(String name, String type, ObjEntity entity)`
  `EmbeddedAttribute(EmbeddedAttribute other)`
  Copying constructor

- ## Method Summary

  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 given `DbAttribute`, 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 an `Embeddable` object.
  `void`
  `removeAttributeOverride(String name)`
  `void`
  `setType(String type)`
  Sets a type of this attribute that must be an `Embeddable` object.

  ### Methods inherited from class ObjAttribute

  `acceptVisitor, getDbAttribute, getDbAttributeName, getDbAttributePath, getDbPathIterator, getDbPathIterator, getEntity, getMaxLength, isFlattened, isInherited, isLazy, isMandatory, isPrimaryKey, isUsedForLocking, setDbAttributePath, setDbAttributePath, setLazy, setUsedForLocking, toString, updateDbAttributePath`
  Modifier and Type
  Method
  Description
  `<T> T`
  `acceptVisitor(ConfigurationNodeVisitor<T> visitor)`
  `DbAttribute`
  `getDbAttribute()`
  Returns a DbAttribute mapped by this ObjAttribute.
  `String`
  `getDbAttributeName()`
  Returns the name of the mapped DbAttribute.
  `CayennePath`
  `getDbAttributePath()`
  Returns a dot-separated path that starts in the root DbEntity that maps to this attribute's ObjEntity and spans zero or more relationships, always ending in a DbAttribute name.
  `Iterator<CayenneMapEntry>`
  `getDbPathIterator()`
  `Iterator<CayenneMapEntry>`
  `getDbPathIterator(ObjEntity entity)`
  `ObjEntity`
  `getEntity()`
  Returns parent entity that holds this attribute.
  `int`
  `getMaxLength()`
  Returns this attribute's maximum allowed length
  `boolean`
  `isFlattened()`
  Returns whether this attribute is "flattened", meaning that it points to a column from an entity other than the DbEntity mapped to the parent ObjEntity.
  `boolean`
  `isInherited()`
  Returns `true` if attribute inherited from a super entity.
  `boolean`
  `isLazy()`
  `boolean`
  `isMandatory()`
  Returns whether this attribute is mandatory
  `boolean`
  `isPrimaryKey()`
  `boolean`
  `isUsedForLocking()`
  Returns whether this attribute should be used for locking.
  `void`
  `setDbAttributePath(String dbAttributePath)`
  `void`
  `setDbAttributePath(CayennePath dbAttributePath)`
  `void`
  `setLazy(boolean lazy)`
  Sets whether this attribute should be loaded lazily.
  `void`
  `setUsedForLocking(boolean usedForLocking)`
  Sets whether this attribute should be used for locking.
  `String`
  `toString()`
  `void`
  `updateDbAttributePath()`
  Updates DbAttributePath for this ObjAttribute

  ### Methods inherited from class Attribute

  `getName, getParent, setEntity, setName, setParent`
  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the name property of this object.
  `Object`
  `getParent()`
  Returns the parent map.
  `void`
  `setEntity(Entity<ObjEntity, ObjAttribute, ObjRelationship> entity)`
  Sets parent entity that holds this attribute.
  `void`
  `setName(String name)`
  `void`
  `setParent(Object parent)`
  Stores the parent map.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### attributeOverrides

    protected Map<String,String> attributeOverrides

- ## Constructor Details

  - ### EmbeddedAttribute

    public EmbeddedAttribute()

  - ### EmbeddedAttribute

    public EmbeddedAttribute(String name)

  - ### EmbeddedAttribute

    public EmbeddedAttribute(String name, String type, ObjEntity entity)

  - ### EmbeddedAttribute

    public EmbeddedAttribute(EmbeddedAttribute other)
    Copying constructor
    Parameters:
      `other` - attribute to copy
    Since:
      4.2

- ## Method Details

  - ### 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 interface `XMLSerializable`
    Overrides:
      `encodeAsXML` in class `ObjAttribute`

  - ### getAttributeOverrides

    public Map<String,String> getAttributeOverrides()

  - ### getEmbeddable

    public Embeddable getEmbeddable()

  - ### getAttributeForDbPath

    public ObjAttribute getAttributeForDbPath(String dbPath)
    Returns an ObjAttribute that maps to a given `DbAttribute`, 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.

  - ### addAttributeOverride

    public void addAttributeOverride(String name, String dbAttributeName)

  - ### removeAttributeOverride

    public void removeAttributeOverride(String name)

  - ### getType

    public String getType()
    Returns a type of this attribute that must be an `Embeddable` object.
    Overrides:
      `getType` in class `ObjAttribute`

  - ### getJavaClass

    public Class<?> getJavaClass()
    Returns Java class of an object property described by this attribute. Wraps any thrown exceptions into CayenneRuntimeException.
    Overrides:
      `getJavaClass` in class `ObjAttribute`

  - ### setType

    public void setType(String type)
    Sets a type of this attribute that must be an `Embeddable` object.
    Overrides:
      `setType` in class `ObjAttribute`