|
Voyager ORB | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectspace.voyager.Facets
Facets is a distributed implementation of the IFacets interface. An instance of Facets is automatically allocated to an object when its first facet is added. The Facets instance is responsible for tracking the facets of an object and ensuring that the object and its facets are garbage collected as a single entity.
Facets uses a simple scheme for determining the class of facet that is added during a MyFacet.of( object ) operation. Assuming that the class of object is MyClass, it attempts to attach a facet that implements IMyFacet and is called XXXMyFacet, where the search starts with XXX="MyClass" and moves up MyClass's superclass chain. If the head of the superclass chain is reached and there is no match for ObjectMyFacet, the last attempted match uses XXX="". During each search cycle, the candidate class is first looked for in the package of MyClass and then in the package of MyFacet.
For example, assume that company.Programmer extends company.Employee which in turn extends java.lang.Object. Assume also that the full path of Hobbies is fun.Hobbies. If the statement Hobbies.of( object ) is executed where object is an instance of Programmer, the search process picks the first class in the following series that exists and implements IHobbies:
company.ProgrammerHobbies
fun.ProgrammerHobbies
company.EmployeeHobbies
fun.EmployeeHobbies
company.ObjectHobbies
fun.ObjectHobbies
company.Hobbies
fun.Hobbies
Method Summary | |
static IFacets |
get(java.lang.Object object)
If the specified object implements IFacets, return the object. |
static java.lang.Object |
get(java.lang.Object object,
java.lang.Class type)
If the specified object is an instance of the specified type, return the object. |
java.lang.Object |
get(java.lang.String classname)
Return a proxy to a facet that implements the specified class. |
java.lang.Object[] |
getFacets()
Return an array of proxies to the primary object's facets. |
java.lang.Object |
getPrimary()
Return a proxy to the primary object. |
static IFacets |
of(java.lang.Object object)
If the specified object implements IFacets, return the object. |
static java.lang.Object |
of(java.lang.Object object,
java.lang.Class type)
If the specified object is an instance of the specified type, return the object. |
java.lang.Object |
of(java.lang.String classname)
Return a proxy to a facet that implements the specified class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public java.lang.Object get(java.lang.String classname)
classname
- The class of facet to get.public java.lang.Object of(java.lang.String classname) throws java.lang.ClassCastException
classname
- The class of facet to get/add.public java.lang.Object getPrimary()
public java.lang.Object[] getFacets()
public static IFacets get(java.lang.Object object)
object
- The primary object.public static IFacets of(java.lang.Object object) throws java.lang.ClassCastException
object
- The primary object.public static java.lang.Object get(java.lang.Object object, java.lang.Class type)
object
- The primary object.type
- The required facet type.public static java.lang.Object of(java.lang.Object object, java.lang.Class type) throws java.lang.ClassCastException
object
- The primary object.type
- The required facet type.
|
ObjectSpace Inc. | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |