classUtils.reflection
Class MethodList

java.lang.Object
  extended by classUtils.reflection.MethodList

public class MethodList
extends java.lang.Object

methodList is a container and processor of methods.


Constructor Summary
MethodList()
           
MethodList(java.lang.Class c)
           
 
Method Summary
 void add(java.lang.reflect.Method m)
           
 void add(java.lang.reflect.Method[] m)
           
 boolean containedBy(java.lang.reflect.Method m)
           
 java.lang.reflect.Method elementAt(int i)
           
static boolean equals(java.lang.reflect.Method m1, java.lang.reflect.Method m2)
          determine if two methods are equal.
 java.lang.reflect.Method[] filter(java.lang.reflect.Method[] m)
          Return all the methods in the array that are not contained in the method list.
 java.lang.reflect.Method[] getAllPublicMethods()
           
 java.lang.reflect.Method[] getAllPublicStaticMethods()
           
 java.lang.reflect.Method[] getFilterList(classUtils.reflection.MethodFilter mf)
           
 java.lang.reflect.Method[] getMainMethods()
          Get a list of all methods that might be considered a main method
 java.lang.reflect.Method[] getMethods()
          return the internally held data as an array of methods;
static java.lang.reflect.Method[] getMethodsWithNArgs(java.lang.reflect.Method[] m, int n)
           
 java.lang.reflect.Method[] getNonStringWriteMethods()
           
 java.lang.reflect.Method[] getNumericReadMethods()
           
static java.lang.reflect.Method[] getPrimMethods(MethodList ml)
           
static java.lang.String getPropertyName(java.lang.reflect.Method m)
           
 java.lang.String[] getPropertyNames()
           
static java.lang.reflect.Method[] getPublicMethods(java.lang.reflect.Method[] m)
           
 java.lang.reflect.Method[] getPublicReadMethods()
           
 java.lang.reflect.Method getReadMethod(java.lang.reflect.Method setter)
           
 java.lang.reflect.Method[] getReadMethods()
          Get a list of accessors
 java.lang.reflect.Method[] getReadMethods(java.lang.Class c)
          Get list of accessors with return type c;
 java.lang.reflect.Method[] getReadWriteMethods()
          Gets a list of methods that have both read and write access.
 java.lang.Class[] getReturnTypes()
           
 java.lang.reflect.Method[] getStringWriteMethods()
           
 java.lang.reflect.Method getWriteMethod(java.lang.reflect.Method accessor)
          Search the list of methods and get the mutator given the accessor.
 java.lang.reflect.Method[] getWriteMethods()
           
static boolean hasFileProperty(java.lang.reflect.Method m)
           
 boolean hasMainMethod()
           
static boolean hasPasswordProperty(java.lang.reflect.Method m)
           
static boolean hasPublicTransientProperty(java.lang.Class c, java.lang.reflect.Method m)
           
 boolean hasReadMethod(java.lang.reflect.Method m)
          return true if input method has a corresponding read method.
 int index(java.lang.reflect.Method m1)
           
static boolean isAcceptableParamList(java.lang.reflect.Method m)
           
static boolean isMutator(java.lang.reflect.Method method)
           
static void main(java.lang.String[] args)
           
 int size()
          get number of methods in list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodList

public MethodList(java.lang.Class c)

MethodList

public MethodList()
Method Detail

hasMainMethod

public boolean hasMainMethod()

getMainMethods

public java.lang.reflect.Method[] getMainMethods()
Get a list of all methods that might be considered a main method

Returns:
method list

getReadMethod

public java.lang.reflect.Method getReadMethod(java.lang.reflect.Method setter)
Parameters:
setter - - given the setter
Returns:
the getter.

getPrimMethods

public static java.lang.reflect.Method[] getPrimMethods(MethodList ml)

index

public int index(java.lang.reflect.Method m1)

isAcceptableParamList

public static boolean isAcceptableParamList(java.lang.reflect.Method m)

getMethodsWithNArgs

public static java.lang.reflect.Method[] getMethodsWithNArgs(java.lang.reflect.Method[] m,
                                                             int n)

getPropertyNames

public java.lang.String[] getPropertyNames()

getPropertyName

public static java.lang.String getPropertyName(java.lang.reflect.Method m)

hasReadMethod

public boolean hasReadMethod(java.lang.reflect.Method m)
return true if input method has a corresponding read method.

Parameters:
m - The input method
Returns:
true if read method present.

getReadWriteMethods

public java.lang.reflect.Method[] getReadWriteMethods()
Gets a list of methods that have both read and write access.

Returns:
the methods that start with "set"

getWriteMethod

public java.lang.reflect.Method getWriteMethod(java.lang.reflect.Method accessor)
Search the list of methods and get the mutator given the accessor.

Parameters:
accessor - must be an accessor
Returns:
the correct method, or null.

getWriteMethods

public java.lang.reflect.Method[] getWriteMethods()
Returns:
list of accessors

isMutator

public static boolean isMutator(java.lang.reflect.Method method)

getAllPublicStaticMethods

public java.lang.reflect.Method[] getAllPublicStaticMethods()

getAllPublicMethods

public java.lang.reflect.Method[] getAllPublicMethods()

getPublicReadMethods

public java.lang.reflect.Method[] getPublicReadMethods()

getPublicMethods

public static java.lang.reflect.Method[] getPublicMethods(java.lang.reflect.Method[] m)

getReadMethods

public java.lang.reflect.Method[] getReadMethods(java.lang.Class c)
Get list of accessors with return type c;

Parameters:
c - return type of the accessors
Returns:
array of methods.

getNumericReadMethods

public java.lang.reflect.Method[] getNumericReadMethods()

getNonStringWriteMethods

public java.lang.reflect.Method[] getNonStringWriteMethods()

getStringWriteMethods

public java.lang.reflect.Method[] getStringWriteMethods()

getFilterList

public java.lang.reflect.Method[] getFilterList(classUtils.reflection.MethodFilter mf)

getReadMethods

public java.lang.reflect.Method[] getReadMethods()
Get a list of accessors

Returns:
all methods that start with get or is

containedBy

public boolean containedBy(java.lang.reflect.Method m)

getReturnTypes

public java.lang.Class[] getReturnTypes()

getMethods

public java.lang.reflect.Method[] getMethods()
return the internally held data as an array of methods;


filter

public java.lang.reflect.Method[] filter(java.lang.reflect.Method[] m)
Return all the methods in the array that are not contained in the method list.


size

public int size()
get number of methods in list


elementAt

public java.lang.reflect.Method elementAt(int i)

add

public void add(java.lang.reflect.Method m)

add

public void add(java.lang.reflect.Method[] m)

equals

public static boolean equals(java.lang.reflect.Method m1,
                             java.lang.reflect.Method m2)
determine if two methods are equal. If they are non-null, have the same names and parameter lists, then they are equal.


hasPublicTransientProperty

public static boolean hasPublicTransientProperty(java.lang.Class c,
                                                 java.lang.reflect.Method m)

hasFileProperty

public static boolean hasFileProperty(java.lang.reflect.Method m)

hasPasswordProperty

public static boolean hasPasswordProperty(java.lang.reflect.Method m)

main

public static void main(java.lang.String[] args)