|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.vleu.visitomatic.VisitableReader
public class VisitableReader
A VisitableReader gives informations about a Visitable
.
More specifically, they analyze fields marked with ToVisit
and
give informations about them.
A VisitableReader built for a class can be used many times for all
instances of this class. Doing so is more efficient.
Visitable
,
ToVisit
Constructor Summary | |
---|---|
VisitableReader(java.lang.Class<? extends Visitable> visitableClass)
Builds a new VisitableReader. A VisitableReader built for a class can be used many times for all instances of this class. |
Method Summary | |
---|---|
int |
getNumberOfValues()
|
java.lang.Object[] |
readValues(Visitable visitable)
Reads the values from fields and methods marked with ToVisit in
the provided Visitable and returns them as an array of objects. |
protected void |
readValues(Visitable visitable,
java.lang.Object[] result)
Reads the values from fields and methods marked with ToVisit in
the provided Visitable and put their value in the provided
array of objects.Overloading this method allows to change the way values are allocated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VisitableReader(java.lang.Class<? extends Visitable> visitableClass)
visitableClass
- The class for which to build a VisitableReaderMethod Detail |
---|
public java.lang.Object[] readValues(Visitable visitable) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
ToVisit
in
the provided Visitable
and returns them as an array of objects.
visitable
- The Visitable
to inspect
ToVisit
, in the order specified
by ToVisit
java.lang.IllegalArgumentException
- The visitable isn't
java.lang.IllegalAccessException
- Java refuses to grant us the right to inspect this object
java.lang.reflect.InvocationTargetException
- We tried to invoke a method which threw an exceptionToVisit
protected void readValues(Visitable visitable, java.lang.Object[] result) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
ToVisit
in
the provided Visitable
and put their value in the provided
array of objects.
visitable
- The Visitable
to inspectresult
- An array that will be modified to containing the visitable and the
values of its fields and methods marked with ToVisit
, in
the order specified by ToVisit
.getNumberOfValues()
.
java.lang.IllegalArgumentException
- The visitable isn't
java.lang.IllegalAccessException
- Java refuses to grant us the right to inspect this object
java.lang.reflect.InvocationTargetException
- We tried to invoke a method which threw an exceptionToVisit
public int getNumberOfValues()
readValues(Visitable)
,
which is also the size of the second argument of
readValues(Visitable, Object[])
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |