Package org.drools.util
Class ClassUtils
java.lang.Object
org.drools.util.ClassUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessorPriorityMap(String field) static TypeactualTypeFromGenerics(Type scope, Type genericType) static TypeactualTypeFromGenerics(Type scope, Type genericType, Class<?> rawClassCursor) static voidaddImportStylePatterns(Map<String, Object> patterns, String str) Populates the import style pattern map from give comma delimited stringstatic StringcanonicalName(Class clazz) static Class<?>static Class<?>classFromType(Type t, Type scope) static StringPlease do not use - internal org.my.Class -> org/my/Class.classstatic StringconvertClassToResourcePath(String pName) static Class<?>convertFromPrimitiveType(Class<?> type) static Class<?>convertPrimitiveNameToType(String typeName) static StringconvertResourceToClassName(String pResourceName) Please do not use - internal org/my/Class.xxx -> org.my.Classstatic Class<?>convertToPrimitiveType(Class<?> type) static ClassextractGenericType(Class<?> clazz, String methodName) static Class<?>findClass(String className, ClassLoader cl) static Class<?>findClass(String name, Collection<String> availableImports, ClassLoader cl) static Class<?>findCommonSuperClass(Class<?> c1, Class<?> c2) static ClassLoaderfindParentClassLoader(Class<?> invokingClass) static MethodgetAccessor(Class<?> clazz, String field) static MethodgetAccessor(Class<?> clazz, String field, boolean exceptionIfIncompatible) getAllImplementedInterfaceNames(Class<?> klass) static StringgetCanonicalSimpleName(Class<?> c) static StringgetCanonicalSimpleName(Class<?> c, char separator) static Class<?>getClassFromName(String className) static Class<?>getClassFromName(String className, boolean initialize, ClassLoader classLoader) static Fieldstatic MembergetFieldOrAccessor(Class clazz, String property) static MethodgetGetterMethod(Class clazz, String property) static StringgetMinimalImplementedInterfaceNames(Class<?> klass) static StringgetPackage(Class<?> cls) Extracts the package name from the given class objectstatic Methodstatic StringgetSimpleName(Class<?> c) static Stringgetter2property(String methodName) static TypegetTypeArgument(Type genericType, int index) static ObjectinstantiateObject(String className) static ObjectinstantiateObject(String className, ClassLoader classLoader) This method will attempt to create an instance of the specified Class.static ObjectinstantiateObject(String className, ClassLoader classLoader, Object... args) This method will attempt to create an instance of the specified Class.static ObjectinstantiateObject(String className, Object... args) This method will attempt to create an instance of the specified Class.static booleanisAssignable(Class<?> type, Object obj) static booleanisAssignableFrom(Type from, Type to) static booleanstatic booleanisCollection(Type t) static booleanisConvertible(Class<?> srcPrimitive, Class<?> tgtPrimitive) static booleanstatic booleanstatic booleanisInterface(Class<?> clazz) static booleanisJboss()static booleanDetermines if a given full qualified class name matches any import style patterns.static booleanisNumericClass(Class<?> clazz) static booleanisOSX()static booleanisReadableProperty(Class clazz, String property) static booleanstatic booleanisTypeCompatibleWithArgumentType(Class<?> actual, Class<?> formal) static booleanstatic Class<?>loadClass(String className, ClassLoader classLoader) This method will attempt to load the specified Class.static Class<?>static Stringstatic Class<?>safeLoadClass(ClassLoader cl, String name) static Stringsetter2property(String methodName) static StringstripExtension(String pResourceName) Please do not use - internal org/my/Class.xxx -> org/my/Classstatic Class<?>toNonPrimitiveType(Class<?> c) static Class<?>toRawClass(Type type)
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
toNonPrimitiveType
-
convertResourceToClassName
Please do not use - internal org/my/Class.xxx -> org.my.Class -
convertClassToResourcePath
Please do not use - internal org.my.Class -> org/my/Class.class -
convertClassToResourcePath
-
stripExtension
Please do not use - internal org/my/Class.xxx -> org/my/Class -
relative
-
canonicalName
-
loadClass
This method will attempt to load the specified Class. It uses a syncrhonized HashMap to cache the reflection Class lookup. -
instantiateObject
-
instantiateObject
This method will attempt to create an instance of the specified Class. It uses a syncrhonized HashMap to cache the reflection Class lookup. -
instantiateObject
This method will attempt to create an instance of the specified Class. It uses a synchronized HashMap to cache the reflection Class lookup. It will execute the default constructor with the passed in arguments- Parameters:
className- the name of the classargs- arguments to default constructor
-
instantiateObject
This method will attempt to create an instance of the specified Class. It uses a synchronized HashMap to cache the reflection Class lookup. It will execute the default constructor with the passed in arguments- Parameters:
className- teh name of the classargs- arguments to default constructor
-
addImportStylePatterns
Populates the import style pattern map from give comma delimited string -
isMatched
Determines if a given full qualified class name matches any import style patterns. -
getPackage
Extracts the package name from the given class object -
findClass
-
findClass
-
getField
-
getAccessor
-
getAccessor
-
accessorPriorityMap
-
getSetter
-
isReadableProperty
-
getFieldOrAccessor
-
getGetterMethod
-
getGetterMethod
-
extractGenericType
-
getTypeArgument
-
isAssignableFrom
-
isCollection
-
classFromType
-
classFromType
-
toRawClass
-
rawType
-
isTypeCompatibleWithArgumentType
-
isAssignable
-
isConvertible
-
isFinal
-
isInterface
-
getter2property
-
setter2property
-
isGetter
-
isSetter
-
convertFromPrimitiveType
-
convertToPrimitiveType
-
convertPrimitiveNameToType
-
getAllImplementedInterfaceNames
-
getMinimalImplementedInterfaceNames
-
isCaseSenstiveOS
public static boolean isCaseSenstiveOS() -
isWindows
public static boolean isWindows() -
isOSX
public static boolean isOSX() -
isJboss
public static boolean isJboss() -
findCommonSuperClass
-
getClassFromName
- Throws:
ClassNotFoundException
-
getClassFromName
public static Class<?> getClassFromName(String className, boolean initialize, ClassLoader classLoader) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
safeLoadClass
-
getSimpleName
-
getCanonicalSimpleName
-
getCanonicalSimpleName
-
findParentClassLoader
-
isNumericClass
-
actualTypeFromGenerics
-
actualTypeFromGenerics
-