com.pmease.quickbuild.util
Class BeanUtils

java.lang.Object
  extended by com.pmease.quickbuild.util.BeanUtils

public class BeanUtils
extends java.lang.Object


Constructor Summary
BeanUtils()
           
 
Method Summary
static java.lang.Object clone(java.lang.Object bean)
           
static void copyFields(java.lang.Object src, java.lang.Object dest, java.lang.Class<?> clazz)
           
static void copyFields(java.lang.Object source, java.lang.Object dest, java.lang.String[] ignores)
           
static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String propertyName)
          Get defined field in specified class of specified name.
static java.util.List<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz)
          Get declared fields in the whole class hierarchy.
static java.lang.reflect.Method getGetter(java.lang.Class<?> clazz, java.lang.String propertyName)
          Get the getter declared in the nearest ancestor of specified class.
static java.util.List<java.lang.reflect.Method> getGetters(java.lang.Class<?> clazz)
          Get declared getter methods in the whole class hierarchy.
static java.lang.String getMethodSuffix(java.lang.String propertyName)
           
static java.lang.String getPropertyName(java.lang.reflect.Method getter)
           
static java.lang.reflect.Method getSetter(java.lang.reflect.Method getter)
          Get the setter declared in the nearest ancestor of specified getter.
static boolean hasGetter(java.lang.Class<?> clazz, java.lang.String propertyName)
           
static boolean hasSetter(java.lang.reflect.Method getter)
           
static boolean isGetter(java.lang.reflect.Method method)
           
static
<T> T
newInstance(T source, java.lang.String[] ignores, java.lang.Object... objects)
           
static java.lang.Object readFile(java.io.File file)
           
static java.lang.Object readFile(java.io.File file, MigrationListener listener)
           
static java.lang.Object readFile(java.io.File file, MigrationListener listener, java.lang.Class<?> beanClass)
           
static void validate(java.lang.Object bean)
           
static void writeFile(java.lang.Object bean, java.io.File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

isGetter

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

getMethodSuffix

public static java.lang.String getMethodSuffix(java.lang.String propertyName)

getGetters

public static java.util.List<java.lang.reflect.Method> getGetters(java.lang.Class<?> clazz)
Get declared getter methods in the whole class hierarchy. If there are getters with the same name in super-class and sub-class, getter in the sub-class with be returned only.


getFields

public static java.util.List<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz)
Get declared fields in the whole class hierarchy. If there are fields with the same name in super-class and sub-class, fields in the sub-class with be returned only.


getField

public static java.lang.reflect.Field getField(java.lang.Class<?> clazz,
                                               java.lang.String propertyName)
Get defined field in specified class of specified name.

Parameters:
clazz -
propertyName -
Returns:
null if not found.

getGetter

public static java.lang.reflect.Method getGetter(java.lang.Class<?> clazz,
                                                 java.lang.String propertyName)
Get the getter declared in the nearest ancestor of specified class.


hasGetter

public static boolean hasGetter(java.lang.Class<?> clazz,
                                java.lang.String propertyName)

getPropertyName

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

hasSetter

public static boolean hasSetter(java.lang.reflect.Method getter)

getSetter

public static java.lang.reflect.Method getSetter(java.lang.reflect.Method getter)
Get the setter declared in the nearest ancestor of specified getter.


copyFields

public static void copyFields(java.lang.Object src,
                              java.lang.Object dest,
                              java.lang.Class<?> clazz)

validate

public static void validate(java.lang.Object bean)

writeFile

public static void writeFile(java.lang.Object bean,
                             java.io.File file)

readFile

public static java.lang.Object readFile(java.io.File file,
                                        MigrationListener listener,
                                        java.lang.Class<?> beanClass)

readFile

public static java.lang.Object readFile(java.io.File file,
                                        MigrationListener listener)

readFile

public static java.lang.Object readFile(java.io.File file)

clone

public static java.lang.Object clone(java.lang.Object bean)

copyFields

public static void copyFields(java.lang.Object source,
                              java.lang.Object dest,
                              java.lang.String[] ignores)

newInstance

public static <T> T newInstance(T source,
                                java.lang.String[] ignores,
                                java.lang.Object... objects)


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.