org.omnaest.utils.reflection
Class ReflectionUtils

java.lang.Object
  extended by org.omnaest.utils.reflection.ReflectionUtils

public class ReflectionUtils
extends Object

Helper for Java Reflection.

Author:
Omnaest

Constructor Summary
ReflectionUtils()
           
 
Method Summary
static int determineDeclaredFieldIndexPosition(Class<?> clazz, Field field)
          Determines the index position of a declared Field within a given Class.
static int determineDeclaredFieldIndexPosition(Class<?> clazz, String fieldname)
          Determines the index position of a declared Field within a given Class.
static int determineDeclaredMethodIndexPosition(Class<?> clazz, Method method)
          Determines the index position of a declared Method within a given Class.
static int determineNumberOfDeclaredFields(Class<?> clazz)
          Returns the number of declared Fields of a Class.
static int determineNumberOfDeclaredMethods(Class<?> clazz)
          Returns the number of declared Methods of a Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

determineDeclaredMethodIndexPosition

public static int determineDeclaredMethodIndexPosition(Class<?> clazz,
                                                       Method method)
Determines the index position of a declared Method within a given Class.

Parameters:
clazz -
method -
Returns:

determineDeclaredFieldIndexPosition

public static int determineDeclaredFieldIndexPosition(Class<?> clazz,
                                                      Field field)
Determines the index position of a declared Field within a given Class.

Parameters:
clazz -
field -
Returns:

determineDeclaredFieldIndexPosition

public static int determineDeclaredFieldIndexPosition(Class<?> clazz,
                                                      String fieldname)
Determines the index position of a declared Field within a given Class.

Parameters:
clazz -
field -
Returns:
-1 if the Field could not be determined at all.

determineNumberOfDeclaredFields

public static int determineNumberOfDeclaredFields(Class<?> clazz)
Returns the number of declared Fields of a Class.

Parameters:
clazz -
Returns:
number of declared Fields or 0 if clazz == null

determineNumberOfDeclaredMethods

public static int determineNumberOfDeclaredMethods(Class<?> clazz)
Returns the number of declared Methods of a Class.

Parameters:
clazz -
Returns:
number of declared Methods or 0 if clazz == null


Copyright © 2011. All Rights Reserved.