|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RdfSerialiser
Implementations of this guide behavior for serialising java objects.
So(m)mer will add the following method to its mapped classes:
running a serialiser can change the values of the fields.
It would be very useful if one could limit access to this method to Sommer packages only.
In fact it would be a very useful if there were a way in java to declare certain packages to be
friendly (they could have full access to the code). The one would not even have to duplicate the
code for every class.
public void rdfSerialise(RdfSerialiser rdfserialiser) {
Field afield[] = Agent.class.getDeclaredFields();
Object o;
for(int i = 0; i < afield.length; i++) {
Field field = afield[i];
try {
if(rdfserialiser.isInterestingField(field))
o = rdfserialiser.addField(this, field, field.get(this));
if (o!=null)
field.set(this,o );
} catch(Exceptions...) { ... }
}
}
Method Summary | |
---|---|
boolean |
isInterestingField(java.lang.reflect.Field fld)
This is method will usually be called first. |
java.lang.Object |
processField(java.lang.Object sourceObj,
java.lang.reflect.Field f,
java.lang.Object value)
This method will process the field. |
Method Detail |
---|
boolean isInterestingField(java.lang.reflect.Field fld)
java.lang.Object processField(java.lang.Object sourceObj, java.lang.reflect.Field f, java.lang.Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |