org.cruxframework.crux.core.utils
Class ClassUtils
java.lang.Object
org.cruxframework.crux.core.utils.ClassUtils
public class ClassUtils
- extends Object
- Author:
- Thiago da Rosa de Bustamante, Samuel Almeida Cardoso
|
Nested Class Summary |
static class |
ClassUtils.PropertyInfo
workaround for JVM BUG - http://codereligion.com/post/28703017143/beware-of-java-beans-introspector |
|
Method Summary |
static ClassUtils.PropertyInfo[] |
extractBeanPropertiesInfo(Type type)
workaround for JVM BUG - http://codereligion.com/post/28703017143/beware-of-java-beans-introspector |
static
|
findAnnotation(Annotation[] searchList,
Class<T> annotation)
|
static Type |
getActualValueOfTypeVariable(Class<?> clazz,
TypeVariable<?> typeVariable)
|
static Class<?> |
getBoxedClassForPrimitive(Class<?> primitiveType)
|
static Type |
getCollectionBaseType(Class<?> type,
Type genericType)
|
static Type |
getGenericReturnTypeOfGenericInterfaceMethod(Class<?> clazz,
Method method)
|
static String |
getGetterMethod(String propertyName)
|
static String |
getGetterMethod(String propertyName,
Class<?> baseClass)
|
static List<Method> |
getGetterMethods(Class<?> objectType)
|
static String |
getMethodDescription(Method method)
|
static String |
getPropertyForGetterOrSetterMethod(Method method)
|
static Class<?> |
getRawType(Type type)
|
static String |
getSetterMethod(String propertyName)
|
static List<Method> |
getSetterMethods(Class<?> objectType)
|
static boolean |
hasCharacterConstructor(Class<?> rawType)
|
static boolean |
hasCharacterConstructor(Type type)
|
static boolean |
hasMethod(Class<?> baseType,
String methodName)
|
static boolean |
hasMethod(Class<?> baseType,
String methodName,
Class<?>[] parameters)
|
static boolean |
hasStringConstructor(Class<?> rawType)
|
static boolean |
hasStringConstructor(Type type)
|
static boolean |
hasValidSetter(Class<?> widgetType,
String setterMethod,
Class<?> attrType)
|
static boolean |
isCollection(Class<?> type)
|
static boolean |
isPropertyVisibleToWrite(Class<?> type,
Field field)
|
static boolean |
isSimpleType(Class<?> rawType)
|
static boolean |
isSimpleType(Type type)
|
static boolean |
isValidGetterMethod(Method method)
|
static boolean |
isValidSetterMethod(Method method)
|
static Type |
resolveGenericTypeOnMethod(Type genericParameterType,
Class<?> baseClass,
Method method)
|
static Object |
stringToPrimitiveBoxType(Class<?> primitiveType,
String value)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassUtils
public ClassUtils()
hasCharacterConstructor
public static boolean hasCharacterConstructor(Class<?> rawType)
- Parameters:
rawType -
- Returns:
hasCharacterConstructor
public static boolean hasCharacterConstructor(Type type)
- Parameters:
type -
- Returns:
hasStringConstructor
public static boolean hasStringConstructor(Class<?> rawType)
- Parameters:
rawType -
- Returns:
hasStringConstructor
public static boolean hasStringConstructor(Type type)
- Parameters:
type -
- Returns:
isSimpleType
public static boolean isSimpleType(Class<?> rawType)
- Parameters:
type -
- Returns:
isSimpleType
public static boolean isSimpleType(Type type)
- Parameters:
type -
- Returns:
getGenericReturnTypeOfGenericInterfaceMethod
public static Type getGenericReturnTypeOfGenericInterfaceMethod(Class<?> clazz,
Method method)
getSetterMethod
public static String getSetterMethod(String propertyName)
- Parameters:
propertyName -
- Returns:
getGetterMethod
public static String getGetterMethod(String propertyName,
Class<?> baseClass)
- Parameters:
propertyName - baseClass -
- Returns:
getGetterMethod
public static String getGetterMethod(String propertyName)
- Parameters:
propertyName -
- Returns:
hasMethod
public static boolean hasMethod(Class<?> baseType,
String methodName)
- Parameters:
baseType - methodName -
- Returns:
hasMethod
public static boolean hasMethod(Class<?> baseType,
String methodName,
Class<?>[] parameters)
- Parameters:
baseType - methodName - parameters -
- Returns:
hasValidSetter
public static boolean hasValidSetter(Class<?> widgetType,
String setterMethod,
Class<?> attrType)
- Parameters:
widgetType - setterMethod -
- Returns:
isValidSetterMethod
public static boolean isValidSetterMethod(Method method)
isValidGetterMethod
public static boolean isValidGetterMethod(Method method)
- Parameters:
method -
- Returns:
getSetterMethods
public static List<Method> getSetterMethods(Class<?> objectType)
getGetterMethods
public static List<Method> getGetterMethods(Class<?> objectType)
- Parameters:
objectType -
- Returns:
getPropertyForGetterOrSetterMethod
public static String getPropertyForGetterOrSetterMethod(Method method)
extractBeanPropertiesInfo
public static ClassUtils.PropertyInfo[] extractBeanPropertiesInfo(Type type)
- workaround for JVM BUG - http://codereligion.com/post/28703017143/beware-of-java-beans-introspector
- Parameters:
type -
- Returns:
resolveGenericTypeOnMethod
public static Type resolveGenericTypeOnMethod(Type genericParameterType,
Class<?> baseClass,
Method method)
getBoxedClassForPrimitive
public static Class<?> getBoxedClassForPrimitive(Class<?> primitiveType)
- Parameters:
primitiveType -
- Returns:
getMethodDescription
public static String getMethodDescription(Method method)
- Parameters:
method -
- Returns:
isPropertyVisibleToWrite
public static boolean isPropertyVisibleToWrite(Class<?> type,
Field field)
- Parameters:
type - field -
- Returns:
stringToPrimitiveBoxType
public static Object stringToPrimitiveBoxType(Class<?> primitiveType,
String value)
getCollectionBaseType
public static Type getCollectionBaseType(Class<?> type,
Type genericType)
isCollection
public static boolean isCollection(Class<?> type)
getRawType
public static Class<?> getRawType(Type type)
findAnnotation
public static <T> T findAnnotation(Annotation[] searchList,
Class<T> annotation)
getActualValueOfTypeVariable
public static Type getActualValueOfTypeVariable(Class<?> clazz,
TypeVariable<?> typeVariable)
Copyright © 2014. All rights reserved.