Package com.inductiveautomation.rm.base
Class RMClassUtils
java.lang.Object
com.inductiveautomation.rm.base.RMClassUtils
Utility methods for Class.
- 
Method Summary
Modifier and TypeMethodDescriptionstatic ClassfromPrimitive(Class aClass) Returns primitive type for non-primitive.static ClassReturns the class for an object.static Class[]getClasses(String aPackageName) Returns the classes in a package name.static ClassgetClassForName(String aName) Returns a class for a given name.static ClassgetClassForName(String aName, Object anObj) Returns a class for a given name, using the class loader of the given class.static StringgetClassSimpleName(Object anObj) Returns simple class name of an object.static StringgetClassStandardName(Object anObj, boolean doSimple) Returns a standard class name of an object, minus any weird notation, like inner-class $, etc.static ClassgetCommonClass(Object... theObjects) Returns the common ancestor class for a list of objects.static ClassgetCommonClass(Object anObj1, Object anObj2) Returns the common ancestor class for two objects.static ClassgetCommonClass(List aList) Returns the common ancestor class for a list of objects.static ClassgetDeclaredClass(Class aClass, String aName) Returns a class for a parent class and a name.static FieldgetDeclaredField(Class aClass, String aName) Returns a field for a parent class and a name.static MethodgetDeclaredMethod(Class aClass, String aName, Class[] theClasses) Returns the declared method for a given class, name and parameter types array.static FieldReturns a field for a parent class and a name.static <T> TgetInstance(Object anObj, Class<T> aClass) Returns the given object as instance of given class, if it is.static URLReturns the Jar URL for given class.static StringgetJarURLS(Class aClass) Returns the root URL for given class (could be a "file:" (directory) or "jar:").static MethodReturns the method for given class, name and parameter types.static ClassgetPrimitiveClassForName(String aName) Returns a primitive class for name.static URLgetRootURL(Class aClass) Returns the plain URL (http: or file:) to the jar for given class.static ClassgetTypeParameterClass(Class aClass) Returns a type parameter class.static booleanisAssignable(Class[] theClasses1, Class[] theClasses2, int aCount) Returns whether second batch of classes is assignable to first batch of classes (accounting for auto-boxing).static booleanisAssignable(Class aClass1, Class aClass2) Returns whether a given class could be assigned a value from the second given class (accounting for auto-boxing).static booleanisAssignablePrimitive(Class aClass1, Class aClass2) Returns whether a given primitive class could be assigned a value from the second given class.static booleanisCompatible(Method aMethod, Class[] theClasses) Returns whether arg classes are compatible.static booleanisPrimitiveClassName(String aName) Returns whether name is a primitive class name.static <T> TnewInstance(Class<T> aClass) Returns a new instance of a given class.static <T> TnewInstance(T anObject) Returns a new instance of a given object.static ClasstoPrimitive(Class aClass) Returns non primitive type for primitive. 
- 
Method Details
- 
getClass
Returns the class for an object. - 
getInstance
Returns the given object as instance of given class, if it is. - 
getClassSimpleName
Returns simple class name of an object. - 
getClassStandardName
Returns a standard class name of an object, minus any weird notation, like inner-class $, etc. - 
getClassForName
Returns a class for a given name. - 
getClassForName
Returns a class for a given name, using the class loader of the given class. - 
isPrimitiveClassName
Returns whether name is a primitive class name. - 
getPrimitiveClassForName
Returns a primitive class for name. - 
newInstance
public static <T> T newInstance(@Nonnull T anObject) Returns a new instance of a given object. - 
newInstance
Returns a new instance of a given class. - 
getField
Returns a field for a parent class and a name. - 
getDeclaredField
Returns a field for a parent class and a name. - 
getMethod
Returns the method for given class, name and parameter types. - 
getDeclaredMethod
Returns the declared method for a given class, name and parameter types array. - 
getDeclaredClass
Returns a class for a parent class and a name. - 
isCompatible
Returns whether arg classes are compatible. - 
isAssignable
Returns whether second batch of classes is assignable to first batch of classes (accounting for auto-boxing). - 
isAssignable
Returns whether a given class could be assigned a value from the second given class (accounting for auto-boxing). - 
isAssignablePrimitive
Returns whether a given primitive class could be assigned a value from the second given class. - 
toPrimitive
Returns non primitive type for primitive. - 
fromPrimitive
Returns primitive type for non-primitive. - 
getCommonClass
Returns the common ancestor class for two objects. - 
getCommonClass
Returns the common ancestor class for a list of objects. - 
getCommonClass
Returns the common ancestor class for a list of objects. - 
getTypeParameterClass
Returns a type parameter class. - 
getClasses
Returns the classes in a package name. Busted for JNLP Web Start. - 
getRootURL
Returns the plain URL (http: or file:) to the jar for given class. - 
getJarURL
Returns the Jar URL for given class. - 
getJarURLS
Returns the root URL for given class (could be a "file:" (directory) or "jar:"). 
 -