|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.Entity
public abstract class Entity
An Entity is an abstract descriptor for an entity mapping concept. Entity can represent either a descriptor of database table or a persistent object.
Field Summary | |
---|---|
protected java.util.SortedMap |
attributes
|
protected DataMap |
dataMap
|
protected java.lang.String |
name
|
static java.lang.String |
PATH_SEPARATOR
|
protected java.util.SortedMap |
relationships
|
Constructor Summary | |
---|---|
Entity()
Creates an unnamed Entity. |
|
Entity(java.lang.String name)
Creates a named Entity. |
Method Summary | |
---|---|
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(java.lang.String attributeName)
Returns attribute with name attributeName or null if no attribute
with this name exists. |
java.util.SortedMap |
getAttributeMap()
Returns an unmodifiable sorted map of entity attributes. |
java.util.Collection |
getAttributes()
Returns an unmodifiable collection of entity attributes. |
DataMap |
getDataMap()
|
java.lang.String |
getName()
Returns entity name. |
java.lang.Object |
getParent()
Returns the parent map. |
Relationship |
getRelationship(java.lang.String relName)
Returns relationship with name relName . |
java.util.SortedMap |
getRelationshipMap()
Returns an unmodifiable map of relationships sorted by name. |
java.util.Collection |
getRelationships()
Returns an unmodifiable collection of Relationships that exist in this entity. |
java.lang.Object |
lastPathComponent(Expression pathExp)
Convenience method returning the last component in the path iterator. |
void |
removeAttribute(java.lang.String attrName)
Removes an attribute named attrName . |
void |
removeRelationship(java.lang.String relName)
Removes a relationship named attrName . |
abstract java.util.Iterator |
resolvePathComponents(Expression pathExp)
Processes expression pathExp and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. |
java.util.Iterator |
resolvePathComponents(java.lang.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(java.lang.String name)
|
void |
setParent(java.lang.Object parent)
Stores the parent map. |
abstract Expression |
translateToRelatedEntity(Expression expression,
java.lang.String relationshipPath)
Translates Expression rooted in this entity to an analogous expression rooted in related entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cayenne.util.XMLSerializable |
---|
encodeAsXML |
Field Detail |
---|
public static final java.lang.String PATH_SEPARATOR
protected java.lang.String name
protected DataMap dataMap
protected java.util.SortedMap attributes
protected java.util.SortedMap relationships
Constructor Detail |
---|
public Entity()
public Entity(java.lang.String name)
Method Detail |
---|
public java.lang.String getName()
getName
in interface CayenneMapEntry
public void setName(java.lang.String name)
public java.lang.Object getParent()
CayenneMapEntry
getParent
in interface CayenneMapEntry
public void setParent(java.lang.Object parent)
CayenneMapEntry
setParent
in interface CayenneMapEntry
public DataMap getDataMap()
public void setDataMap(DataMap dataMap)
public Attribute getAttribute(java.lang.String attributeName)
attributeName
or null if no attribute
with this name exists.
public void addAttribute(Attribute attribute)
public void removeAttribute(java.lang.String attrName)
attrName
.
public void clearAttributes()
public Relationship getRelationship(java.lang.String relName)
relName
. Will return null if no
relationship with this name exists in the entity.
public void addRelationship(Relationship relationship)
public void removeRelationship(java.lang.String relName)
attrName
.
public void clearRelationships()
public java.util.SortedMap getRelationshipMap()
public Relationship getAnyRelationship(Entity targetEntity)
public java.util.Collection getRelationships()
public java.util.SortedMap getAttributeMap()
public java.util.Collection getAttributes()
public abstract Expression translateToRelatedEntity(Expression expression, java.lang.String relationshipPath)
public java.lang.Object lastPathComponent(Expression pathExp)
resolvePathComponents(Expression)
public abstract java.util.Iterator 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.
ExpressionException
public java.util.Iterator resolvePathComponents(java.lang.String path) throws ExpressionException
ExpressionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |