Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.portal.common.reflect
Class Reflection

    java.lang.Object
      org.jboss.portal.common.reflect.Reflection

    public class Reflection

extends java.lang.Object

Version:
  $Revision: 1.1 $
Author:
  Julien Viet

Constructor Summary
`Reflection()`

Method Summary
`static java.lang.reflect.Method` | `findMethod(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] parameterTypes)` Search a method on the specified class.
`static
`<T> T`
` | `safeCast(java.lang.Object value, java.lang.Class<T> type)` Attempt to cast the value argument to the provided type argument.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Reflection

    public Reflection()

Method Detail

### findMethod

    public static java.lang.reflect.Method findMethod(java.lang.Class clazz,
                                                      java.lang.String methodName,
                                                      java.lang.Class[] parameterTypes)
                                               throws java.lang.IllegalArgumentException

  Search a method on the specified class. The search will try find methods with any scope and will start with the provided class. First it will inspect the public method on the class, if one is found then this method is returned. If no public method is found then it will inspect the declared methods of the provided class and its super classes.

  Parameters:
    `clazz` - the class to inspect
    `methodName` - the method name
    `parameterTypes` - the parameter types
  Returns:
    the matched method or null
  Throws:
    `java.lang.IllegalArgumentException` - if one argument is null

### safeCast

    public static <T> T safeCast(java.lang.Object value,
                                 java.lang.Class<T> type)
                      throws java.lang.IllegalArgumentException

  Attempt to cast the value argument to the provided type argument. If the value argument type is assignable to the provided type, the value is returned, otherwise if it is not or the value is null, null is returned.

  Parameters:
    `value` - the value to cast
    `type` - the type to downcast
  Returns:
    the casted value or null
  Throws:
    `java.lang.IllegalArgumentException` - if the type argument is null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008. All Rights Reserved.