org.xenei.jena.entities.impl.handlers
Class EntityHandler

java.lang.Object
  extended by org.xenei.jena.entities.impl.handlers.EntityHandler
All Implemented Interfaces:
ObjectHandler

public class EntityHandler
extends Object
implements ObjectHandler

An ObjectHandler that creates EntityManager managed entities from RDFResources and visa versa.


Constructor Summary
EntityHandler(EntityManager entityManager, Class<?> valueClass)
          Constructor.
 
Method Summary
 com.hp.hpl.jena.rdf.model.RDFNode createRDFNode(Object obj)
          Create an RDFNode representation for the subject class.
 boolean equals(Object o)
           
 int hashCode()
           
 Object parseObject(com.hp.hpl.jena.rdf.model.RDFNode node)
          Use the entity manager to create an instance of the valueClass from the resource.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityHandler

public EntityHandler(EntityManager entityManager,
                     Class<?> valueClass)
Constructor.

Parameters:
entityManager - The EntityManager to use.
valueClass - The Subject annotated class to create.
Method Detail

createRDFNode

public com.hp.hpl.jena.rdf.model.RDFNode createRDFNode(Object obj)
Create an RDFNode representation for the subject class.

Specified by:
createRDFNode in interface ObjectHandler
Parameters:
obj - The object to represent
Returns:
The RDFNode representation

parseObject

public Object parseObject(com.hp.hpl.jena.rdf.model.RDFNode node)
Use the entity manager to create an instance of the valueClass from the resource. Effectively calls entityManager.read( node.asResource, valueClass )

Specified by:
parseObject in interface ObjectHandler
Parameters:
node - The RDFNode to wrap with the valueClass.
Returns:
the instance of the valueClass.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 XENEI.com. All Rights Reserved.