com.oracle.determinations.engine
Class EntityInstance
java.lang.Object
com.oracle.determinations.engine.EntityInstance
public final class EntityInstance
extends java.lang.ObjectAn entity instance represents an instance of an entity object. An
EntityInstance object contains values for Attributes in a way that resembles
AttributeInstance objects in the C++ engine.
Method Summary
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object | getAttributeValue(java.lang.String attrName)Gets an attributes value for this entity instance. |
java.util.List<EntityInstance> | getChildren(Entity entity)Retrieve a list of all the child entity instance for the given entity. |
EntityInstance | getContainingEntityInstance() |
Entity | getEntity()Returns the defining Entity object for this EntityInstance. |
int | getIdentifier()Return the unique identifier for this EntityInstance. |
java.lang.String | getName()Return the unique name for this EntityInstance. |
Session | getSession()Returns the Session object in which this EntityInstance is contained. |
boolean | isContainmentComplete(Entity entity)Returns true if for this entity instance, all instances of the supplied child entity have been created. |
boolean | isHypothetical()A hypothetical entity instance is used in cases where no instances of an
entity exist, but it is useful to explore the possibility of what were to
happen if it did. |
void | markContainmentComplete(boolean complete,
Entity entity)Sets whether or not for this entity instance, all instances of the supplied child entity have been created |
void | setAttributeValue(java.lang.String attrName,
java.lang.Object value)Sets an attribute's value on this entity instance. |
void | setName(java.lang.String name)Sets a unique name for this EntityInstance. |
java.lang.String | toString()Returns a string representation of the object. |
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Method Detail
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String attrName)
Gets an attributes value for this entity instance.
- Parameters:
attrName- the name of the attribute- Returns:
- an object representation of the attribute's value
- Throws:
java.lang.IllegalArgumentException- if the specified attribute does not exist in this instance's entity- Since:
- 12.0
- See Also:
Attribute.getValue(EntityInstance)
getChildren
public java.util.List<EntityInstance> getChildren(Entity entity)
Retrieve a list of all the child entity instance for the given entity.
- Parameters:
entity- the child entity of this instance to get the known children of- Returns:
- the List<EntityInstance> of all known child entity instances of this entity type
- Throws:
java.lang.IllegalArgumentException- if the specified entity is not a child of this instance's entity
getContainingEntityInstance
public EntityInstance getContainingEntityInstance()
- Returns:
- the entity that contains this entity instance. Returns null in the case of the global entity instance.
getEntity
public final Entity getEntity()
Returns the defining
Entity object for this EntityInstance.- Returns:
- the Entity for which this EntityInstance is an instance
getIdentifier
public final int getIdentifier()
Return the unique identifier for this EntityInstance. Identifiers are
unique for an entity instance within the context of its entity. Identifiers
can only be considered persistent for the lifetime of the containing
Session. Once an entity instance is stored and retrieved, for instance
in XDS format, it is likely to have a different identifier. Unlike instance
names, identifiers are guaranteed to be persistent for the lifetime of the
entity instance.
- Returns:
- the unique identifier for this entity instance
getName
public java.lang.String getName()
Return the unique name for this EntityInstance. Unlike identifiers, names
may be user set, allowing them to be persistent across the lifetime
of stored sessions while retaining their uniqueness. If the user does not
supply an instance name, the engine will create a unique value. Names
are unique for an entity instance within the context of its entity.
- Returns:
- the unique name for this entity instance
getSession
public final Session getSession()
Returns the
Session object in which this EntityInstance is contained.- Returns:
- the Session to which this EntityInstance belongs
isContainmentComplete
public boolean isContainmentComplete(Entity entity)
Returns true if for this entity instance, all instances of the supplied child entity have been created.
- Parameters:
entity- an entity contained by this entity- Returns:
trueif for this entity instance, all instances of the supplied child entity have been created.
isHypothetical
public boolean isHypothetical()
A hypothetical entity instance is used in cases where no instances of an
entity exist, but it is useful to explore the possibility of what were to
happen if it did. For example, if a relationship is incomplete, a
decision report may still explore 'hypothetical' targets of that
relationship.
- Returns:
trueif the entity instance is a hypothetical entity instance andfalseotherwise.
markContainmentComplete
public void markContainmentComplete(boolean complete,
Entity entity)Sets whether or not for this entity instance, all instances of the supplied child entity have been created
- Parameters:
complete- is containment complete for the supplied child entity?entity- an entity contained by this entity
setAttributeValue
public void setAttributeValue(java.lang.String attrName,
java.lang.Object value)Sets an attribute's value on this entity instance.
- Parameters:
attrName- the name of the attributevalue- the attribute's value to be set- Throws:
java.lang.IllegalArgumentException- if the specified attribute does not exist in this instance's entity- Since:
- 12.0
- See Also:
Attribute.setValue(EntityInstance, Object)
setName
public void setName(java.lang.String name)
Sets a unique name for this EntityInstance. Being user set values, names
may be persistent across the lifetime of stored sessions while retaining
their uniqueness. Names are unique for an entity instance within the
context of its entity. Names may be set or altered at any time. If the
supplied name already exists, or is null, an exception will be thrown.
- Parameters:
name- the new name of the entity instance
toString
public java.lang.String toString()
Returns a string representation of the object.
- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the object.