panmx.util
Class BeanUtil

java.lang.Object
  extended by panmx.util.BeanUtil

public final class BeanUtil
extends java.lang.Object

Class with utility functions for working with beans. This class SHOULD NOT be used outside the PanMX package as it is likely to change without notice.


Constructor Summary
BeanUtil()
           
 
Method Summary
static java.lang.reflect.Method getAccessor(java.lang.Class type, java.lang.String name)
          Return the accessor method for attribute with specified name.
static java.lang.String getAttributeName(java.lang.reflect.Method method)
          Return name of attribute assuming method is a mutator or accesor.
static java.lang.reflect.Method getMutator(java.lang.Class type, java.lang.String name, java.lang.Class attributeType, boolean mustBePublic)
          Return the mutator method for attribute with specified name and type.
static java.lang.String[] getSignature(java.lang.reflect.Method method)
          Return the signature of method as an array of strings.
static boolean isAccessor(java.lang.reflect.Method method)
          Return true if method matches naming convention for accessor.
static boolean isAttributeMethod(java.lang.reflect.Method method)
          Return true if method is either an accessor or a mutator.
static boolean isMutator(java.lang.reflect.Method method)
          Return true if method matches naming convention for mutator.
static java.lang.String makeFullyQualifiedName(java.lang.reflect.Method method)
          Make a fully qualified method name for specified method.
static java.lang.String makeFullyQualifiedName(java.lang.String actionName, java.lang.String[] signature)
          Make a fully qualified method name from specified parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtil

public BeanUtil()
Method Detail

isAttributeMethod

public static boolean isAttributeMethod(java.lang.reflect.Method method)
Return true if method is either an accessor or a mutator.

Parameters:
method - the method.
Returns:
true if method is either an accessor or a mutator.

isAccessor

public static boolean isAccessor(java.lang.reflect.Method method)
Return true if method matches naming convention for accessor.

Parameters:
method - the method.
Returns:
true if method matches naming convention for accessor.

isMutator

public static boolean isMutator(java.lang.reflect.Method method)
Return true if method matches naming convention for mutator.

Parameters:
method - the method.
Returns:
true if method matches naming convention for mutator.

getAttributeName

public static java.lang.String getAttributeName(java.lang.reflect.Method method)
Return name of attribute assuming method is a mutator or accesor.

Parameters:
method - the method.
Returns:
the attribute name.

getAccessor

public static java.lang.reflect.Method getAccessor(java.lang.Class type,
                                                   java.lang.String name)
                                            throws javax.management.openmbean.OpenDataException
Return the accessor method for attribute with specified name.

Parameters:
type - the type to retrieve method from.
name - the name of the attribute.
Returns:
the accessor method if any.
Throws:
javax.management.openmbean.OpenDataException - if unable to find accessor method.

getMutator

public static java.lang.reflect.Method getMutator(java.lang.Class type,
                                                  java.lang.String name,
                                                  java.lang.Class attributeType,
                                                  boolean mustBePublic)
                                           throws javax.management.openmbean.OpenDataException
Return the mutator method for attribute with specified name and type.

Parameters:
type - the type to retrieve method from.
name - the name of the attribute.
attributeType - the attribute attributeType.
Returns:
the mutator method if any.
Throws:
javax.management.openmbean.OpenDataException - if unable to find mutator method.

getSignature

public static java.lang.String[] getSignature(java.lang.reflect.Method method)
Return the signature of method as an array of strings.

Parameters:
method - the method.
Returns:
the signature.

makeFullyQualifiedName

public static java.lang.String makeFullyQualifiedName(java.lang.reflect.Method method)
Make a fully qualified method name for specified method.

Parameters:
method - the method.
Returns:
the fully qualified method name.

makeFullyQualifiedName

public static java.lang.String makeFullyQualifiedName(java.lang.String actionName,
                                                      java.lang.String[] signature)
Make a fully qualified method name from specified parameters.

Parameters:
actionName - the name of method.
signature - the types of each parameter.
Returns:
the fully qualified method name.


Copyright © 2005-2006 . All Rights Reserved.