org.xenei.jena.entities
Interface EntityManager

All Known Implementing Classes:
EntityManagerImpl

public interface EntityManager

An Entity Manager to manage instances of entities annotated with the Subject annotation Subject Annotation The EntityManager handles all client interactions with the Jena Model using the annotated classes.

See Also:
Subject

Method Summary
 SubjectInfo getSubjectInfo(Class<?> clazz)
          Get the SubjectInfo for the class.
 boolean isInstance(Object target, Class<?> clazz)
          Determine if target has all the properties required in the Subject( type ) annotation value.
 void parseClasses(String packageName)
          Parses the the classes in a package (and subpackages) looking for Subject annotated classes.
 void parseClasses(String[] packageNames)
          Parses the the classes in an array of packages (and subpackages) looking for Subject annotated classes.
<T> T
read(Object source, Class<T> primaryClass, Class<?>... secondaryClasses)
          Read an instance of clazz from source.
 Object update(Object source, Object target)
          Calls the target.setX predicate methods with the results of the source.getX predicate methods.
 

Method Detail

getSubjectInfo

SubjectInfo getSubjectInfo(Class<?> clazz)
Get the SubjectInfo for the class.

Parameters:
clazz - The class to get SubjectInfo for.
Returns:
The SubjectInfo
Throws:
IllegalArgumentException - if clazz is not properly annotated with Subject annotations.

read

<T> T read(Object source,
           Class<T> primaryClass,
           Class<?>... secondaryClasses)
Read an instance of clazz from source. Does not verify that the resource passes the isInstance() check.

Parameters:
source - Must either implement Resource or ResourceWrapper interfaces.
primaryClass - The class of the object to be returned.
secondaryClasses - A lost of other classes that are implemented.
Returns:
primaryClass instance that also implements ResourceWrapper.
Throws:
MissingAnnotation - if any of the classes do not have Subject annotations.
IllegalArgumentException - if source implements neither Resource nor ResourceWrapper.
See Also:
isInstance(Object, Class)

isInstance

boolean isInstance(Object target,
                   Class<?> clazz)
Determine if target has all the properties required in the Subject( type ) annotation value. If target is not a Resource or ResourceWrapper returns false.

Parameters:
target - The object to check.
clazz - A Subject annotated class.
Returns:
true if the resource represented by target has all of the required type predicates.
Throws:
IllegalArgumentException - if clazz is not a Subject annotated class.

parseClasses

void parseClasses(String packageName)
                  throws MissingAnnotation
Parses the the classes in a package (and subpackages) looking for Subject annotated classes. Classes are located using classLoader.getResource(packageAsPath)

Parameters:
packageName - The name of the package to process
Throws:
MissingAnnotation
See Also:
If any Subject annotated classes are missing required annotations, a log entry is written. If any Subject annotated classes faild parsing a MissingAnnotation exception is thrown after all classes have been processed.

parseClasses

void parseClasses(String[] packageNames)
                  throws MissingAnnotation
Parses the the classes in an array of packages (and subpackages) looking for Subject annotated classes. Classes are located using classLoader.getResource(packageAsPath) If any Subject annotated classes are missing required annotations, a log entry is written. If any Subject annotated classes faild parsing a MissingAnnotation exception is thrown after all classes have been processed.

Parameters:
packageNames - The array of package names to process
Throws:
MissingAnnotation
See Also:
ClassLoader.getResources(String)

update

Object update(Object source,
              Object target)
              throws IllegalArgumentException
Calls the target.setX predicate methods with the results of the source.getX predicate methods.

Parameters:
source - The object to copy data from.
target - The object to copy data to.
Returns:
The target object for chaining.
Throws:
IllegalArgumentException


Copyright © 2012 XENEI.com. All Rights Reserved.