net.java.rdf.sommer
Interface RewriteMapper

All Known Implementing Classes:
Mapping, SesameMapper

public interface RewriteMapper

These are the methods required by JavassistClassRewriter

Author:
Henry Story

Method Summary
 void cifpName(java.lang.Object thiz, java.lang.Class clazz, java.lang.Class[] argTypes, java.lang.Object[] values)
          Deprecated. No longer rewrite constructors
<T> T
cifpObject(java.lang.Class<T> clazz, java.lang.Class[] argTypes, java.lang.Object[] values)
          Deprecated. No longer rewrite constructors
<T> RDFCollection<T>
createVirtualCollection(java.lang.Object thiz, rdf relation, java.util.Collection<T> old, java.lang.reflect.Type fieldType)
          get the value of a virtual collection field.
<T> java.util.Collection<T>
getCollectionField(java.lang.Object thiz, rdf relation, java.util.Collection<T> old, java.lang.reflect.Type fieldType)
          get the value of a collection field.
 java.lang.Object getField(java.lang.Class fieldClass, java.lang.Object obj, rdf relation, java.lang.Object value)
          Get the value of a field
<T> RDFCollection<T>
replaceVirtualCollection(java.lang.Object thiz, rdf relation, java.util.Collection<T> oldColl, java.util.Collection<T> newColl, java.lang.reflect.Type genType)
          Replace the elements in the collection with the new elements.
<T> java.util.Collection<T>
setCollectionField(java.lang.Object sourceObj, rdf relation, java.util.Collection<T> newColl, java.lang.reflect.Type typeT)
          Set a Collection on a given field.
 java.lang.Object setField(java.lang.Class fieldClass, java.lang.Object obj, rdf relation, java.lang.Object value)
          Set a given field
 

Method Detail

setCollectionField

<T> java.util.Collection<T> setCollectionField(java.lang.Object sourceObj,
                                               rdf relation,
                                               java.util.Collection<T> newColl,
                                               java.lang.reflect.Type typeT)
Set a Collection on a given field.

Parameters:
obj - the object on which the field is attached
relation - rdf annotation on the field
newcoll - the value that the field should be set to
type - the generic type of the collection (if known)
Returns:
The object the field is set to

getCollectionField

<T> java.util.Collection<T> getCollectionField(java.lang.Object thiz,
                                               rdf relation,
                                               java.util.Collection<T> old,
                                               java.lang.reflect.Type fieldType)
get the value of a collection field. These are collections that have the (at)functional annotation (or something with a better name, when I get round to it) They are collections that really appear as collections in the rdf store.

Parameters:
fieldType - the generic type of the collection
obj - the object on which the field is attached
relation - annotation on this field
old - the old value of the field - the one currently referred to
Returns:
The object the field is set to

createVirtualCollection

<T> RDFCollection<T> createVirtualCollection(java.lang.Object thiz,
                                             rdf relation,
                                             java.util.Collection<T> old,
                                             java.lang.reflect.Type fieldType)
get the value of a virtual collection field. This will only be called once: on mapping of the object into the graph. Later the object present in the field will be returned. should this be also called when the object gets unmapped, so that it can return an unmapped collection?

Parameters:
thiz - the object on which the field is attached
relation - annotation on this field
old - the old value of the field - the one currently referred to
fieldType - Gernics type info of the Collection
Returns:
The object the field is set to

replaceVirtualCollection

<T> RDFCollection<T> replaceVirtualCollection(java.lang.Object thiz,
                                              rdf relation,
                                              java.util.Collection<T> oldColl,
                                              java.util.Collection<T> newColl,
                                              java.lang.reflect.Type genType)
Replace the elements in the collection with the new elements.

Parameters:
thiz - the object on which the field is attached
relation - the annotation on the field
oldColl - the old collection that the field was set to
newColl - the new collection the it should be replaced by
genType - the type of the objects in the collection
Returns:
the collection containing the objects related to thiz by relation. This may be the same object as oldColl

setField

java.lang.Object setField(java.lang.Class fieldClass,
                          java.lang.Object obj,
                          rdf relation,
                          java.lang.Object value)
Set a given field

Parameters:
fieldClass - The class of the field being set
obj - The object on which the field is attached
relation - The rdf annotation on the field
value - the value that the field should be set to
Returns:
The object the field is set to

getField

java.lang.Object getField(java.lang.Class fieldClass,
                          java.lang.Object obj,
                          rdf relation,
                          java.lang.Object value)
Get the value of a field

Parameters:
fieldClass - the class of the field
obj - the object on which the field is located
relation - the rdf annotation on the field
value - the current value of the field
Returns:
the value of the field

cifpName

void cifpName(java.lang.Object thiz,
              java.lang.Class clazz,
              java.lang.Class[] argTypes,
              java.lang.Object[] values)
Deprecated. No longer rewrite constructors

Set the name for thiz to an existing one if one exists. The relations together form a CIFP (see http://esw.w3.org/topic/CIFP) The array size for relations and values should be the same

Parameters:
thiz - the object to be named
clazz - the class of the constructor
argTypes - the argument types identifying the particular constructor
values - the values

cifpObject

<T> T cifpObject(java.lang.Class<T> clazz,
                 java.lang.Class[] argTypes,
                 java.lang.Object[] values)
Deprecated. No longer rewrite constructors

Check to see if we don't allready have an object that corresponds to this cifp

Parameters:
clazz - the class on which the constructor is being called
argTypes - the types of the arguments of the constructor, to help find the constructor
Returns:
the object that allready corresponded to that cifp, or null if none