org.apache.stanbol.enhancer.servicesapi.helper
Class RdfEntityFactory
java.lang.Object
org.apache.stanbol.enhancer.servicesapi.helper.RdfEntityFactory
- Direct Known Subclasses:
- SimpleRdfEntityFactory
public abstract class RdfEntityFactory
- extends java.lang.Object
A Factory that creates proxies over rdf nodes.
- Author:
- Rupert Westenthaler
|
Method Summary |
static RdfEntityFactory |
createInstance(org.apache.clerezza.rdf.core.MGraph graph)
Creates a new factory for the parsed MGraph instance. |
abstract
|
getProxy(org.apache.clerezza.rdf.core.NonLiteral rdfNode,
java.lang.Class<T> type,
java.lang.Class<?>... additionalInterfaces)
Getter for a proxy for the parsed rdf node that implements all the parsed
Interfaces. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RdfEntityFactory
public RdfEntityFactory()
createInstance
public static RdfEntityFactory createInstance(org.apache.clerezza.rdf.core.MGraph graph)
- Creates a new factory for the parsed
MGraph instance.
- Parameters:
graph - the graph used by the proxies created by this factory to
read/write there data
- Returns:
- the created factory
getProxy
public abstract <T extends RdfEntity> T getProxy(org.apache.clerezza.rdf.core.NonLiteral rdfNode,
java.lang.Class<T> type,
java.lang.Class<?>... additionalInterfaces)
throws java.lang.IllegalArgumentException
- Getter for a proxy for the parsed rdf node that implements all the parsed
Interfaces. The interface parsed as type must extend
RdfEntity.
Additional interfaces must not extend this interface.
Interfaces parsed as parameter:
- SHOULD have an
Rdf annotation. If that is the case, than the
according rdf:type statements are checks/added when the proxy is created
- all methods of the parsed interfaces MUST HAVE
Rdf
annotations. Calling methods with missing annotations causes an
IllegalStateException at runtime
- all methods of the parsed interface MUST HAVE a return type or a
single parameter (e.g. void setSomething(String value) or String
getSomething). Methods with a parameter do set the parsed data. Methods
with a return type do read the data.
Proxies returned by this Factory:
- MUST NOT have an internal state. They need to represent a view over
the current data within the
MGraph instance. Direct changes to
the graph need to be reflected in calls to proxies.
- Implementations need to support
Collection as parameter.
Collections need to represent a live view over the triples within the
MGraph. However iterators may throw a
ConcurrentModificationException if the graph changes while using
the iterator.
- Type Parameters:
T - The interface implemented by the returned proxy- Parameters:
rdfNode - the rdfNode represented by the proxy (created if not
present in the Graph)type - The interface for the proxy. Needs to extend RdfEntityadditionalInterfaces - Additional interfaces the proxy needs to
implement.
- Returns:
- A proxy representing the parsed rdf node and implementing all the
parsed interfaces
- Throws:
java.lang.IllegalArgumentException - if the node is null or the
parsed interfaces do not fulfil the requirements as stated.
java.lang.NullPointerException - if the parameter type, additionalInterfaces
or any entry of additionalInterfaces is null.
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.