T - the domain class of the object selection node.public interface OSRole<T> extends Visitable<OSRole<?>>
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(OSRole<?> child)
Adds a child to this (parent) node.
|
T |
castToType(Object obj)
If possible, returns a down-casted reference to the supplied object.
|
T |
createNewInstance()
Creates a new domain instance, using the default (empty) constructor.
|
boolean |
equalsUsingKey(Key keyToUse,
Object anObject,
Object anOtherObject)
Compares two domain instances using the specified key.
|
AttributeConstant |
getAttributeConstant(String attributeName)
Get the attribute constant that matches the specified attribute name.
|
AttributeConstant[] |
getAttributeConstants()
Returns an array of the attribute constants for this object selection
node
|
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.
|
Class<T> |
getDomainClass()
Gets the domain class object.
|
List<Key> |
getKeys()
Returns the keys for this role.
|
Key |
getMainKey()
Gets the main key of the object selection role
|
OSRole<?> |
getParent()
Gets the parent of this node.
|
Object |
getRelation(Object domainObject,
RoleConstant role)
Gets the specified associated relation from the domain object.
|
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).
|
Object |
getValue(Object domainObject,
AttributeConstant attribute)
Gets the specified attribute value from the domain object.
|
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 |
isNavigableToParent()
Returns
true if the relation from this role to the parent is
navigable. |
boolean |
isParentMany()
Test if the association to the parent role is a many-association.
|
boolean |
isPersistent()
Test if the role is persistent.
|
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.
|
boolean |
isUpRelated()
Test if this role is an up-related child.
|
void |
setMainKey(Key mainKey)
Sets the main key.
|
void |
setRelation(Object domainInstance,
Object relation,
RoleConstant role)
Sets the specified relation on the domain object
|
void |
setValue(Object domainObject,
AttributeConstant attribute,
Object value)
Sets the specified attribute value on the domain object.
|
String |
toString()
Returns the role name of this os node.
|
void |
updateRelation(Object domainInstance,
Object relation,
RoleConstant role)
Updates the specified relation.
|
void |
visitBranch(Visitor<OSRole<?>> visitor)
Visit this node and all child nodes (recursively).
|
void addChild(OSRole<?> child)
child - the child to addIllegalArgumentException - if this is not the parent of the child
or the child is already added.T castToType(Object obj)
obj - the object to downcastnull if
the object is not assignable to type T.T createNewInstance()
AttributeConstant[] getAttributeConstants()
Map<AttributeConstant,Object> getAttributeValues(Object domainInstance)
domainInstance - the domain instanceList<OSRole<?>> getChildren()
OSRole<?> getChild(RoleConstant childRole)
childRole - the child role constantClass<T> getDomainClass()
Key getMainKey()
OSRole<?> getParent()
OSRole<?> getRoot()
List<Key> getKeys()
RoleConstant getRoleConstant()
Map<AttributeConstant,Object> getValues(Object instance, AttributeConstant[] attributes)
instance - the domain instanceattributes - a string array of attribute namesObject getValue(Object domainObject, AttributeConstant attribute)
domainObject - the domain objectattribute - the constant denoting the attribute.Object getRelation(Object domainObject, RoleConstant role)
domainObject - the domain object that holds the relation.role - the constant enum denoting the role.void setValue(Object domainObject, AttributeConstant attribute, Object value)
domainObject - the domain objectattribute - the constant denoting the attribute.value - the value to setvoid setRelation(Object domainInstance, Object relation, RoleConstant role)
domainInstance - the domain objectrelation - the related objectrole - the constant denoting the relationvoid updateRelation(Object domainInstance, Object relation, RoleConstant role)
setRelation(Object, Object, RoleConstant). If the
specified role is many-related, the relation collection is updated.domainInstance - The relation owner.relation - the relation member.role - the role of the member relation.RelationType getRelationType()
RelationCardinality getRelationCardinality()
String toString()
boolean isNavigableToParent()
true if the relation from this role to the parent is
navigable.true if the relation to parent is navigable.void setMainKey(Key mainKey)
mainKey - the mainKey to setboolean equalsUsingKey(Key keyToUse, Object anObject, Object anOtherObject)
Note that both domain instances must be assignable to the type of the object selection role, otherwise a class cast exception is thrown.
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.ClassCastException - if either domain object can not be assigned to
the object selection role type.boolean isAncestorOf(RoleConstant possibleHeir)
possibleHeir. 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.possibleHeir - the role that is possible a child or grand (grand..)
child of this role.possibleHeir.boolean isRelated(AttributeConstant attribute)
attribute - the attribute to check the relation to.true if the attribute path contains "this" role.boolean isUpRelated()
true if this role is up-related.boolean isParentMany()
true if the association to parent is many-related.boolean isPersistent()
true if the role is persistent.AttributeConstant getAttributeConstant(String attributeName)
attributeName - the attribute nameboolean isMany()
true if the association to this role from the parent
is a many-relation.boolean isRoot()
true if this is a root node in the object selection
tree.Copyright © 2006–2017 Esito AS. All rights reserved.