| Modifier and Type | Field and Description |
|---|---|
RelationCardinality |
CARDINALITY
The relation cardinality of the node.
|
protected List<Key> |
keys
The list of keys.
|
RelationType |
RELATION_TYPE
The relation type.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOSRole(OSRole<?> parent,
RelationType relationType,
RelationCardinality cardinality,
RoleConstant roleConstant)
Constructs a new object selection role.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Visitor<OSRole<?>> visitor)
Accept a visitor and by invoking the vistor's visit method.
|
void |
addChild(OSRole<?> child)
Adds a child to this (parent) node.
|
T |
castToType(Object obj)
If possible, returns a downcasted reference to the supplied object.
|
boolean |
equalsUsingKey(Key keyToUse,
Object anObject,
Object anOtherObject)
Compares two domain instances using the specified key.
|
Map<AttributeConstant,Object> |
getAttributeValues(Object domainInstance)
Gets a map of attribute values from the domain object.
|
OSRole<?> |
getChild(RoleConstant childRole)
Gets the child role for the given child role constant.
|
List<OSRole<?>> |
getChildren()
Gets an unmodifiable list of child nodes.
|
Key |
getMainKey()
Gets the main key of the object selection role
|
OSRole<?> |
getParent()
Gets the parent of this node.
|
protected Object |
getRelatedValue(Object domainObject,
AttributeConstant attribute)
Get an attribute value from a related role.
|
RelationCardinality |
getRelationCardinality()
Get the role's cardinality.
|
RelationType |
getRelationType()
Get the relation type enumeration for this role.
|
RoleConstant |
getRoleConstant()
Gets the role name of this node.
|
OSRole<?> |
getRoot()
Gets the root of this role (roots return self).
|
Map<AttributeConstant,Object> |
getValues(Object instance,
AttributeConstant[] attributes)
Returns a map of attributes values.
|
boolean |
isAncestorOf(RoleConstant possibleHeir)
Test if this role is ancestor of
possibleHeir. |
boolean |
isMany()
Test if the association to this role from the parent role is a
many-association.
|
boolean |
isRelated(AttributeConstant attribute)
Test if an attribute is a related attribute of this object selection
role.
|
boolean |
isRoot()
Test if this is a root node.
|
void |
setMainKey(Key mainKey)
Sets the main key.
|
protected void |
setRelatedValue(Object domainObject,
AttributeConstant attribute,
Object value)
Set an attribute value on a related role.
|
String |
toString()
Returns a string with the role name prefixed with "Role: ".
|
void |
visitBranch(Visitor<OSRole<?>> visitor)
Visit this node and all child nodes (recursively).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateNewInstance, getAttributeConstant, getAttributeConstants, getDomainClass, getKeys, getRelation, getValue, isNavigableToParent, isParentMany, isPersistent, isUpRelated, setRelation, setValue, updateRelationpublic final RelationCardinality CARDINALITY
public final RelationType RELATION_TYPE
protected AbstractOSRole(OSRole<?> parent, RelationType relationType, RelationCardinality cardinality, RoleConstant roleConstant)
parent - the parent of this node.relationType - the type of relation to parent.cardinality - the cardinality of this node.roleConstant - the constant denoting this role.public RelationType getRelationType()
OSRolegetRelationType in interface OSRole<T>public RelationCardinality getRelationCardinality()
OSRolegetRelationCardinality in interface OSRole<T>public Map<AttributeConstant,Object> getAttributeValues(Object domainInstance)
OSRolegetAttributeValues in interface OSRole<T>domainInstance - the domain instancepublic OSRole<?> getParent()
public final RoleConstant getRoleConstant()
getRoleConstant in interface OSRole<T>public Map<AttributeConstant,Object> getValues(Object instance, AttributeConstant[] attributes)
public void addChild(OSRole<?> child)
addChild in interface OSRole<T>child - the child to addIllegalArgumentException - if this is not the parent of the child
or the child is already added.public List<OSRole<?>> getChildren()
getChildren in interface OSRole<T>public OSRole<?> getChild(RoleConstant childRole)
public T castToType(Object obj)
castToType in interface OSRole<T>obj - the object to downcastnull if
the object is not assignable to type T.public String toString()
public void setMainKey(Key mainKey)
OSRolesetMainKey in interface OSRole<T>mainKey - the mainKey to setpublic Key getMainKey()
getMainKey in interface OSRole<T>public boolean equalsUsingKey(Key keyToUse, Object anObject, Object anOtherObject)
OSRoleNote that both domain instances must be assignable to the type of the object selection role, otherwise a class cast exception is thrown.
equalsUsingKey in interface OSRole<T>keyToUse - the key to use when comparing the two instances.anObject - the first object to compareanOtherObject - the other object to comparetrue if all attributes in the keys are equal in both
domain objects.protected Object getRelatedValue(Object domainObject, AttributeConstant attribute)
domainObject - the current domain object.attribute - the attribute value to get.protected void setRelatedValue(Object domainObject, AttributeConstant attribute, Object value)
domainObject - the current domain object.attribute - the attribute value to set.value - the new attribute value.public boolean isRelated(AttributeConstant attribute)
OSRolepublic boolean isAncestorOf(RoleConstant possibleHeir)
OSRolepossibleHeir. A role
A is an ancestor of another role B if the A
role can be reached by navigating up (in direction of the root) from the
B role.isAncestorOf in interface OSRole<T>possibleHeir - the role that is possible a child or grand (grand..)
child of this role.possibleHeir.public boolean isMany()
OSRolepublic boolean isRoot()
OSRolepublic OSRole<?> getRoot()
OSRolepublic void accept(Visitor<OSRole<?>> visitor)
Visitableaccept in interface Visitable<OSRole<?>>visitor - the visitor visiting this visitable.Visitor.visit(Object)Copyright © 2006–2018 Esito AS. All rights reserved.