FileDocCategorySizeDatePackage
PropertyUtils.javaAPI DocGlassfish v2 API4624Fri May 04 22:34:38 BST 2007com.sun.enterprise.tools.common

PropertyUtils

public class PropertyUtils extends Object
author
vkraemer
version

Fields Summary
Constructors Summary
private PropertyUtils()
Creates new PropertyUtils

    
Methods Summary
private static java.lang.StringcreateGetterName(java.lang.String propName)

            String retVal = "get";//NOI18N
            String capitalizedProp = propName.toUpperCase();
            return retVal + capitalizedProp.substring(0,1) + propName.substring(1);
        
public static java.lang.reflect.MethodgetReader(java.lang.Object target, java.lang.String destFieldName)

        try {
            PropertyDescriptor destPd = new PropertyDescriptor(destFieldName, target.getClass());
            return destPd.getReadMethod();
        }
        catch (java.beans.IntrospectionException t) {
            //Reporter.critical(new StackTrace(t)); //NOI18N
            //throw t;
            return getReader2(target,destFieldName);
        }
    
public static java.lang.reflect.MethodgetReader2(java.lang.Object target, java.lang.String destFieldName)

            String getterName = createGetterName(destFieldName);
            Class targetClass = null;
        try {
            targetClass = target.getClass();
            Method reader = targetClass.getMethod(getterName,null);
            return reader;
            //PropertyDescriptor destPd = new PropertyDescriptor(destFieldName, target.getClass());
            //return destPd.getReadMethod();
        }
        catch (Throwable t) {
            Method[] allmethods = targetClass.getMethods();
            for (int i = 0; null != allmethods && i < allmethods.length; i++)
                Reporter.info(allmethods[i].getReturnType() + " " +allmethods[i].getName());//NOI18N
            Reporter.critical(new StackTrace(t)); //NOI18N
            throw new java.beans.IntrospectionException(getterName);
            //return getReader2(target,destFieldName);
        }
        
public static java.lang.reflect.MethodgetWriter(java.lang.Object target, java.lang.String destFieldName)

        try {
            PropertyDescriptor destPd = new PropertyDescriptor(destFieldName, target.getClass());
            return destPd.getWriteMethod();
        }
        catch (java.beans.IntrospectionException t) {
            Reporter.critical(new StackTrace(t)); //NOI18N
            throw t;
        }