org.xenei.jena.entities.impl
Class PredicateInfoImpl

java.lang.Object
  extended by org.xenei.jena.entities.impl.PredicateInfoImpl
All Implemented Interfaces:
PredicateInfo

public class PredicateInfoImpl
extends Object
implements PredicateInfo

The parsed information about a predicate method. Use of this class registers three (3) new RDFDatatypes: CharacterDatatype that parses Character objects CharDatatype that parses char.class objects LongDatatype that parses Longs and always returns a long.


Constructor Summary
PredicateInfoImpl(EntityManager entityManager, org.xenei.jena.entities.impl.EffectivePredicate predicate, String methodName, Class<?> valueClass)
          Constructor.
 
Method Summary
static List<String> dataTypeDump(String format, String nullClassString)
          Create a sorted list of registered data types.
 Object exec(Method method, com.hp.hpl.jena.rdf.model.Resource resource, Object[] args)
          Execute the method against the resource with the arguments.
 ActionType getActionType()
          Get the action type for the functin.
static ObjectHandler getHandler(EntityManager entityManager, Class<?> returnType, org.xenei.jena.entities.impl.EffectivePredicate pred)
          Get the ObjectHandler for a predicate.
 String getMethodName()
          Get the method name that this predicate info is describing.
 String getNamespace()
          Get the namespace URI for the predicate.
 ObjectHandler getObjectHandler()
           
 com.hp.hpl.jena.rdf.model.Property getProperty()
          Get the predicate as a property.
 String getUriString()
          Get the predicate URI as a string.
 Class<?> getValueClass()
          get the value class.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PredicateInfoImpl

public PredicateInfoImpl(EntityManager entityManager,
                         org.xenei.jena.entities.impl.EffectivePredicate predicate,
                         String methodName,
                         Class<?> valueClass)
                  throws MissingAnnotation
Constructor.

Parameters:
entityManager - The EntityManager that this predicate is assocatied with.
predicate - The EffectivePredicate instance that describes the predicate.
methodName - The name of the method that this predicate calls.
valueClass - The class type for the return (getter) or parameter (setter)
Throws:
MissingAnnotation - If an annotation was required but not provided.
Method Detail

dataTypeDump

public static List<String> dataTypeDump(String format,
                                        String nullClassString)
Create a sorted list of registered data types. The format is a String.format format string for two (2) string inputs. The first one is the URI of the data type, the second the class name or a blank. To reverse the display use "%2$s | %1$s" If the nullCLassString is null registered data types without classes will not be included.

Parameters:
format - The output format or "%s | %s" if not specified.
nullClassString - the string to print for null java class.
Returns:
A sorted list of registeded data types.

exec

public Object exec(Method method,
                   com.hp.hpl.jena.rdf.model.Resource resource,
                   Object[] args)
Execute the method against the resource with the arguments.

Parameters:
method - The method to execute
resource - The resource to execute it against
args - The arguments to the method.
Returns:
The result of the execution
Throws:
NullPointerException - if the return type of the method is a primitive and the predicate does not exist on the resource.

getMethodName

public String getMethodName()
Description copied from interface: PredicateInfo
Get the method name that this predicate info is describing.

Specified by:
getMethodName in interface PredicateInfo
Returns:
the method name

getActionType

public ActionType getActionType()
Get the action type for the functin.

Specified by:
getActionType in interface PredicateInfo
Returns:
the action type for the predicate.

getNamespace

public String getNamespace()
Description copied from interface: PredicateInfo
Get the namespace URI for the predicate.

Specified by:
getNamespace in interface PredicateInfo
Returns:
The namespace URI.

getValueClass

public Class<?> getValueClass()
Description copied from interface: PredicateInfo
get the value class. The value class is the class that is returned (for a getter type method) or the class type of the argument (for a setter type method).

Specified by:
getValueClass in interface PredicateInfo
Returns:
The class

toString

public String toString()
Overrides:
toString in class Object

getUriString

public String getUriString()
Description copied from interface: PredicateInfo
Get the predicate URI as a string.

Specified by:
getUriString in interface PredicateInfo
Returns:
The URI for the predicate.

getProperty

public com.hp.hpl.jena.rdf.model.Property getProperty()
Description copied from interface: PredicateInfo
Get the predicate as a property.

Specified by:
getProperty in interface PredicateInfo
Returns:
The property for the predicate.

getObjectHandler

public ObjectHandler getObjectHandler()

getHandler

public static ObjectHandler getHandler(EntityManager entityManager,
                                       Class<?> returnType,
                                       org.xenei.jena.entities.impl.EffectivePredicate pred)
Get the ObjectHandler for a predicate.

Parameters:
entityManager - The entity manager this to use.
returnType - The ObjectHandler of the proper type
pred - The EffectivePredicate definition.
Returns:
The object handler.


Copyright © 2012 XENEI.com. All Rights Reserved.