public abstract class Entity extends Object implements CayenneMapEntry, XMLSerializable, Serializable
| Modifier and Type | Field and Description | 
|---|---|
| protected SortedMap<String,Attribute> | attributes | 
| protected DataMap | dataMap | 
| protected String | name | 
| static String | OUTER_JOIN_INDICATORA prefix or a suffix that can be used in a path component to indicate that an OUTER
 JOIN should be used when resolving the expression. | 
| static String | PATH_SEPARATOR | 
| protected SortedMap<String,Relationship> | relationships | 
| Constructor and Description | 
|---|
| Entity()Creates an unnamed Entity. | 
| Entity(String name)Creates a named Entity. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAttribute(Attribute attribute)Adds new attribute to the entity, setting its parent entity to be this object. | 
| void | addRelationship(Relationship relationship)Adds new relationship to the entity. | 
| void | clearAttributes() | 
| void | clearRelationships() | 
| Relationship | getAnyRelationship(Entity targetEntity)Returns a relationship that has a specified entity as a target. | 
| Attribute | getAttribute(String attributeName)Returns attribute with name  attributeNameor null if no attribute
 with this name exists. | 
| SortedMap<String,? extends Attribute> | getAttributeMap()Returns an unmodifiable sorted map of entity attributes. | 
| Collection<? extends Attribute> | getAttributes()Returns an unmodifiable collection of entity attributes. | 
| DataMap | getDataMap() | 
| String | getName()Returns entity name. | 
| Object | getParent()Returns the parent map. | 
| Relationship | getRelationship(String relName)Returns relationship with name  relName. | 
| SortedMap<String,? extends Relationship> | getRelationshipMap()Returns an unmodifiable map of relationships sorted by name. | 
| Collection<? extends Relationship> | getRelationships()Returns an unmodifiable collection of Relationships that exist in this entity. | 
| <T extends Attribute,U extends Relationship> | lastPathComponent(Expression path,
                 Map aliasMap)Convenience method returning the last component in the path iterator. | 
| void | removeAttribute(String attrName)Removes an attribute named  attrName. | 
| void | removeRelationship(String relName)Removes a relationship named  attrName. | 
| abstract <T extends Attribute,U extends Relationship> | resolvePath(Expression pathExp,
           Map aliasMap)Returns an Iterable over the path components with elements represented as
  PathComponentinstances, encapsulating a relationship, an attribute or a
 subpath alias. | 
| abstract Iterator<CayenneMapEntry> | resolvePathComponents(Expression pathExp)Processes expression  pathExpand returns an Iterator of path
 components that contains a sequence of Attributes and Relationships. | 
| Iterator<CayenneMapEntry> | resolvePathComponents(String path)Returns an Iterator over the path components that contains a sequence of Attributes
 and Relationships. | 
| void | setDataMap(DataMap dataMap)Sets parent DataMap of this entity. | 
| void | setName(String name) | 
| void | setParent(Object parent)Stores the parent map. | 
| String | toString() | 
| abstract Expression | translateToRelatedEntity(Expression expression,
                        String relationshipPath)Translates Expression rooted in this entity to an analogous expression rooted in
 related entity. | 
| void | updateAttribute(Attribute attribute) | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitencodeAsXMLpublic static final String PATH_SEPARATOR
public static final String OUTER_JOIN_INDICATOR
protected String name
protected DataMap dataMap
protected final SortedMap<String,Relationship> relationships
public Entity()
public Entity(String name)
public String getName()
getName in interface CayenneMapEntrypublic void setName(String name)
public Object getParent()
CayenneMapEntrygetParent in interface CayenneMapEntrypublic void setParent(Object parent)
CayenneMapEntrysetParent in interface CayenneMapEntrypublic DataMap getDataMap()
public void setDataMap(DataMap dataMap)
public Attribute getAttribute(String attributeName)
attributeName or null if no attribute
 with this name exists.public void addAttribute(Attribute attribute)
public void removeAttribute(String attrName)
attrName.public void updateAttribute(Attribute attribute)
public void clearAttributes()
public Relationship getRelationship(String relName)
relName. Will return null if no
 relationship with this name exists in the entity.public void addRelationship(Relationship relationship)
public void removeRelationship(String relName)
attrName.public void clearRelationships()
public SortedMap<String,? extends Relationship> getRelationshipMap()
public Relationship getAnyRelationship(Entity targetEntity)
public Collection<? extends Relationship> getRelationships()
public SortedMap<String,? extends Attribute> getAttributeMap()
public Collection<? extends Attribute> getAttributes()
public abstract Expression translateToRelatedEntity(Expression expression, String relationshipPath)
public <T extends Attribute,U extends Relationship> PathComponent<T,U> lastPathComponent(Expression path, Map aliasMap)
public abstract <T extends Attribute,U extends Relationship> Iterable<PathComponent<T,U>> resolvePath(Expression pathExp, Map aliasMap)
PathComponent instances, encapsulating a relationship, an attribute or a
 subpath alias. An optional "aliasMap" parameter is used to resolve subpaths from
 aliases.
 This method is lazy: if path is invalid and can not be resolved from this entity, this method will still return an Iterator, but an attempt to read the first invalid path component will result in ExpressionException.
public abstract Iterator<CayenneMapEntry> resolvePathComponents(Expression pathExp) throws ExpressionException
pathExp and returns an Iterator of path
 components that contains a sequence of Attributes and Relationships. Note that if
 path is invalid and can not be resolved from this entity, this method will still
 return an Iterator, but an attempt to read the first invalid path component will
 result in ExpressionException.ExpressionExceptionpublic Iterator<CayenneMapEntry> resolvePathComponents(String path) throws ExpressionException
ExpressionExceptionCopyright © 2001–2023 Apache Cayenne. All rights reserved.