com.steptools.stdev
Class EntityInstanceImpl

java.lang.Object
  extended by com.steptools.stdev.EntityInstanceImpl
All Implemented Interfaces:
EntityInstance, Instance, java.lang.Cloneable

public abstract class EntityInstanceImpl
extends java.lang.Object

Supertype for EXPRESS classes for entities.


Method Summary
 EntityInstance castTo(java.lang.Class supertype)
           
 EntityInstance castTo(Domain req)
          Gets a view of the object that can be cast to the requested type.
 java.lang.Object clone()
          Generate a shallow copy of this object
 Domain domain()
          Get the Domain of this object
 boolean equals(java.lang.Object other)
           
 EntityInstance getFinalObject()
          Gets the base object for this instance.
abstract  EntityDomain getLocalDomain()
          Gets the domain for the view object.
 boolean isa(Domain req)
          This method determines if this EntityInstance is an instance of the specified domain.
 boolean isView()
          This function determines if this object is a view, or if it is the final object.
 EntityInstanceSet usedin(EntityInstanceSet scope, Attribute att)
          This method implements an EXPRESS-like USEDIN facility.
 EntityInstanceSet usedin(EntityInstanceSet scope, EntityDomain start, Attribute att)
          This method implements an EXPRESS-like USEDIN facility.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFinalObject

public EntityInstance getFinalObject()
Description copied from interface: EntityInstance
Gets the base object for this instance. There are cases where the EXPRESS inheritance model cannot be cleanly mapped to Java. In this case, one or more proxy classes may be created what provide a view of the entity instance as a particular supertype. This method returns the non-view object.

You should use this method to obtain a canonical view of an EntityInstance before comparing two objects.

Returns:
The non-view version of the instance.

isView

public boolean isView()
Description copied from interface: EntityInstance
This function determines if this object is a view, or if it is the final object.

Returns:
true If this is a view object.

domain

public final Domain domain()
Description copied from interface: Instance
Get the Domain of this object

Returns:
The Domain for this object. If this is a view object, the domain for the base, and not for the view is returned.

getLocalDomain

public abstract EntityDomain getLocalDomain()
Description copied from interface: EntityInstance
Gets the domain for the view object. This will be different from the value returned by domain() when this instance is a view object

Returns:
The domain corresponding class of this object.

castTo

public EntityInstance castTo(Domain req)
                      throws EntityCastException,
                             SchemaStructureException
Description copied from interface: EntityInstance
Gets a view of the object that can be cast to the requested type. This may be the same object, or it may be a view object. In either case, it will be safe to use a Java cast to convert the result to the requested type.

Parameters:
req - The domain to cast the current object to.
Returns:
An object that implements the interface associated with the domain
Throws:
EntityCastException - If this instance cannot be cast to the requested type
SchemaStructureException

castTo

public EntityInstance castTo(java.lang.Class supertype)
                      throws EntityCastException,
                             DomainNotFoundException
Throws:
EntityCastException
DomainNotFoundException

isa

public boolean isa(Domain req)
Description copied from interface: EntityInstance
This method determines if this EntityInstance is an instance of the specified domain. This function retuns the same value regardless of which view of the EntityInstance is is called on.

Returns:
true If this instance can be cast to the requested type.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Instance
Generate a shallow copy of this object

Specified by:
clone in interface Instance
Overrides:
clone in class java.lang.Object
Returns:
A copy of this object
Throws:
java.lang.CloneNotSupportedException - If this method cannot be cloned. This is not thrown be any ST-Developer class, but was provided in the java.lang.Object prototype for clone().

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

usedin

public EntityInstanceSet usedin(EntityInstanceSet scope,
                                EntityDomain start,
                                Attribute att)
Description copied from interface: EntityInstance
This method implements an EXPRESS-like USEDIN facility. This can be used to locate the instances that point to this instance through a specified attribute. This method processes attributes that are of types Select and Aggregate by looking searching the underlying Select or Aggregate for this object.

Specified by:
usedin in interface EntityInstance
Parameters:
scope - The set of instances to search for references to this.
start - Further limit the scope of instances.
att - The attribute that is being queried.
Returns:
The set of EntityInstances that reference this via the specified attribute.

usedin

public EntityInstanceSet usedin(EntityInstanceSet scope,
                                Attribute att)
Description copied from interface: EntityInstance
This method implements an EXPRESS-like USEDIN facility. This can be used to locate the instances that point to this instance through a specified attribute. This method processes attributes that are of types Select and Aggregate by looking searching the underlying Select or Aggregate for this object.

Specified by:
usedin in interface EntityInstance
Parameters:
scope - The set of instances to search for references to this.
att - The attribute that is being queried.
Returns:
The set of EntityInstances that reference this via the specified attribute.