Package com.inductiveautomation.rm.base
Class RMClassUtils
java.lang.Object
com.inductiveautomation.rm.base.RMClassUtils
Utility methods for Class.
- 
Method SummaryModifier 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- 
getClassReturns the class for an object.
- 
getInstanceReturns the given object as instance of given class, if it is.
- 
getClassSimpleNameReturns simple class name of an object.
- 
getClassStandardNameReturns a standard class name of an object, minus any weird notation, like inner-class $, etc.
- 
getClassForNameReturns a class for a given name.
- 
getClassForNameReturns a class for a given name, using the class loader of the given class.
- 
isPrimitiveClassNameReturns whether name is a primitive class name.
- 
getPrimitiveClassForNameReturns a primitive class for name.
- 
newInstancepublic static <T> T newInstance(@Nonnull T anObject) Returns a new instance of a given object.
- 
newInstanceReturns a new instance of a given class.
- 
getFieldReturns a field for a parent class and a name.
- 
getDeclaredFieldReturns a field for a parent class and a name.
- 
getMethodReturns the method for given class, name and parameter types.
- 
getDeclaredMethodReturns the declared method for a given class, name and parameter types array.
- 
getDeclaredClassReturns a class for a parent class and a name.
- 
isCompatibleReturns whether arg classes are compatible.
- 
isAssignableReturns whether second batch of classes is assignable to first batch of classes (accounting for auto-boxing).
- 
isAssignableReturns whether a given class could be assigned a value from the second given class (accounting for auto-boxing).
- 
isAssignablePrimitiveReturns whether a given primitive class could be assigned a value from the second given class.
- 
toPrimitiveReturns non primitive type for primitive.
- 
fromPrimitiveReturns primitive type for non-primitive.
- 
getCommonClassReturns the common ancestor class for two objects.
- 
getCommonClassReturns the common ancestor class for a list of objects.
- 
getCommonClassReturns the common ancestor class for a list of objects.
- 
getTypeParameterClassReturns a type parameter class.
- 
getClassesReturns the classes in a package name. Busted for JNLP Web Start.
- 
getRootURLReturns the plain URL (http: or file:) to the jar for given class.
- 
getJarURLReturns the Jar URL for given class.
- 
getJarURLSReturns the root URL for given class (could be a "file:" (directory) or "jar:").
 
-