net.ctdp.rfdynhud.properties
Class GenericFieldsIterator<T>

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.GenericFieldsIterator<T>
Type Parameters:
T - the runtime type of the iterated fields
All Implemented Interfaces:
java.util.Iterator<T>
Direct Known Subclasses:
GenericPositionsIterator, GenericPropertiesIterator, GenericSizesIterator

public abstract class GenericFieldsIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

Iterates all Field values of a given Class. This includes all super classes and even private fields.

It is implemented using generics and a dirty trick to access private fields.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
GenericFieldsIterator(java.lang.Object object)
           
GenericFieldsIterator(java.lang.Object object, boolean includeStatic)
           
 
Method Summary
protected abstract  boolean checkFieldType(java.lang.reflect.Field field)
          Checks, if the field is of a type, that we want to iterate.
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericFieldsIterator

public GenericFieldsIterator(java.lang.Object object,
                             boolean includeStatic)

GenericFieldsIterator

public GenericFieldsIterator(java.lang.Object object)
Method Detail

checkFieldType

protected abstract boolean checkFieldType(java.lang.reflect.Field field)
Checks, if the field is of a type, that we want to iterate.

Parameters:
field -
Returns:
true, if the field is interesting, false otherwise.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()
Specified by:
next in interface java.util.Iterator<T>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<T>