Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.enhanced
Class Polymorphic  view Polymorphic download Polymorphic.java

java.lang.Object
  extended bycom.hp.hpl.jena.enhanced.Polymorphic
Direct Known Subclasses:
EnhGraph, EnhNode

public abstract class Polymorphic
extends java.lang.Object

Abstract base class for all polymorphic RDF objects, especially enhanced node and enhanced graph.


Field Summary
private  Polymorphic ring
          Each new polymorphic object is in a ring of views
 
Constructor Summary
(package private) Polymorphic()
          initially we're in the singleton ring.
 
Method Summary
 void addView(Polymorphic other)
          add another view for this object.
protected  boolean already(java.lang.Class t)
          Answer true iff this is already acceptable to the given type t.
protected  Polymorphic asInternal(java.lang.Class t)
          Answer a polymorphic object that presents this in a way which satisfies type t.
protected abstract  boolean canSupport(java.lang.Class t)
          subclasses must provide a method for testing if _this_ can be converted to an instance of _t_.
protected abstract  Polymorphic convertTo(java.lang.Class t)
          subclasses must provide a method for converting _this_, if possible, into an instance of _t_.
abstract  boolean equals(java.lang.Object o)
          subclasses must override equals.
private  Polymorphic findExistingView(java.lang.Class t)
          find an existing view in the ring which is an instance of _t_ and return it; otherwise return null.
protected abstract  Personality getPersonality()
          Answer the personality object bound to this polymorphic instance
abstract  boolean isValid()
          answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.
 boolean supports(java.lang.Class t)
          return _true_ iff this polymorphic object supports the specified interface.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ring

private Polymorphic ring
Each new polymorphic object is in a ring of views

Constructor Detail

Polymorphic

Polymorphic()
initially we're in the singleton ring.

Method Detail

getPersonality

protected abstract Personality getPersonality()
Answer the personality object bound to this polymorphic instance


already

protected boolean already(java.lang.Class t)
Answer true iff this is already acceptable to the given type t. Delegates to t to test if this class is an acceptable implementation.


supports

public boolean supports(java.lang.Class t)
return _true_ iff this polymorphic object supports the specified interface. Synonymous with "does the argument class have this as an instance". Actually it shouldn't be. Review.


asInternal

protected final Polymorphic asInternal(java.lang.Class t)
Answer a polymorphic object that presents this in a way which satisfies type t.


findExistingView

private Polymorphic findExistingView(java.lang.Class t)
find an existing view in the ring which is an instance of _t_ and return it; otherwise return null. If _this_ is an instance, the search takes care to find it first.


isValid

public abstract boolean isValid()
answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.


convertTo

protected abstract Polymorphic convertTo(java.lang.Class t)
subclasses must provide a method for converting _this_, if possible, into an instance of _t_. It will only be called if _this_ doesn't already have (or be) a suitable ring-sibling.


canSupport

protected abstract boolean canSupport(java.lang.Class t)
subclasses must provide a method for testing if _this_ can be converted to an instance of _t_.


equals

public abstract boolean equals(java.lang.Object o)
subclasses must override equals. Actually they may not have to nowadays ... I have expunged the clever facet-identity test (and indeed facets).


addView

public void addView(Polymorphic other)
add another view for this object. other must be freshly constructed. To be called by subclasses when they have constructed a new view for this object. This method is public ONLY so that it can be tested. TODO find a better way to make it testable.