|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.util.ClassHelper
public abstract class ClassHelper
This abstract class contains dynamic (reflect-based) class, method, and field manipulation methods.
Note: This class is primarily for supporting generated code.
| Field Summary | |
|---|---|
static java.lang.Object[] |
VOIDUseful constant for methods with no arguments. |
static java.lang.Class[] |
VOID_PARAMSUseful constant for methods with no parameters. |
| Constructor Summary | |
|---|---|
ClassHelper() |
|
| Method Summary | |
|---|---|
static java.lang.reflect.Method |
findMethod(java.lang.Class clz, java.lang.String sName, java.lang.Class[] aclzParam, boolean fStatic)Find a Method that matches the specified name and parameter types. |
static java.lang.String |
getCompositeName(java.lang.Class clz, java.lang.String sName)Build the composite name of a class based on an existing class and a second class name. |
static java.lang.String |
getCompositeName(java.lang.String sName1, java.lang.String sName2)Build the composite name of a class based on an existing class name and a second class name. |
static java.lang.String |
getCompositePackage(java.lang.String pkg1, java.lang.String pkg2)Build the composite name of a package based on two package names. |
static java.lang.String |
getDerivedName(java.lang.Class clz, java.lang.String sPrefix)Build the name of a "derived" class based on an existing class and a "derived" class prefix. |
static java.lang.String |
getDerivedName(java.lang.String sName, java.lang.String sPrefix)Build the name of a "derived" class based on the name of an existing class and a "derived" class prefix. |
static java.lang.String |
getPackageName(java.lang.Class clz)Determine the package name of a class. |
static java.lang.String |
getPackageName(java.lang.String sName)Determine the package name from a class (or package) name. |
static Resources |
getPackageResources(java.lang.Class clz)Load the default package resources for the specified class. |
static Resources |
getPackageResources(java.lang.String sClass)Load the default package resources for the specified class name. |
static java.lang.String |
getQualifiedName(java.lang.String pkg, java.lang.String sName)Build the fully qualified name of a class based on a package name and a simple class name. |
static Resources |
getResources(java.lang.Class clz, java.lang.String sName)Load the named resources for the specified class. |
static java.lang.String |
getSimpleName(java.lang.Class clz)Determine the simple (unqualified) name of a class. |
static java.lang.String |
getSimpleName(java.lang.String sName)Determine the simple (unqualified) name of a class. |
static java.lang.Object |
invoke(java.lang.Class clz, java.lang.Object obj, java.lang.String sName, java.lang.Object[] aoParam)Invoke the specified method using the passed arguments. |
static java.lang.Object |
invoke(java.lang.Object obj, java.lang.String sName, java.lang.Object[] aoParam)Invoke the specified instance method using the passed arguments. |
static java.lang.Object |
invokeStatic(java.lang.Class clz, java.lang.String sName, java.lang.Object[] aoParam)Invoke the specified static method using the passed arguments. |
static boolean |
isInstanceOf(java.lang.Object obj, java.lang.Class clz)Determine if the passed object is an instance of the specified class. |
static boolean |
isInstanceOf(java.lang.Object obj, java.lang.String sClz)Determine if the passed object is an instance of the specified class. |
static boolean |
isPartialNameLegal(java.lang.String sName)Determine if a partial name (for example, a prefix, class name, package name, etc. as accepted by the above methods) is legal. |
static boolean |
isQualifiedNameLegal(java.lang.String sName)Determine if the passed string is a legal dot-delimited identifier. |
static boolean |
isSimpleNameLegal(java.lang.String sName)Determine if the passed string is a legal simple name. |
static java.lang.Object |
newInstance(java.lang.Class clz, java.lang.Object[] aoParam)Instantiate the specified class using the specified parameters. |
| Field Detail |
|---|
public static final java.lang.Class[] VOID_PARAMS
public static final java.lang.Object[] VOID
| Constructor Detail |
|---|
public ClassHelper()
| Method Detail |
|---|
public static boolean isInstanceOf(java.lang.Object obj,
java.lang.String sClz)
obj - the objectsClz - the class name
public static boolean isInstanceOf(java.lang.Object obj,
java.lang.Class clz)
obj - the objectclz - the classpublic static java.lang.String getPackageName(java.lang.Class clz)
clz - the class to determine the package ofpublic static java.lang.String getPackageName(java.lang.String sName)
in out ------- ------- [blank] [blank] a [blank] .a .a. a. a. .a. .a. a.b a. .a.b .a. a.b. a.b. .a.b. .a.b.
sName - the class name to determine the package ofpublic static java.lang.String getSimpleName(java.lang.Class clz)
clz - the class to determine the simple name ofpublic static java.lang.String getSimpleName(java.lang.String sName)
in out ------- ------- [blank] [blank] a a .a [blank] a. [blank] .a. [blank] a.b b .a.b b a.b. [blank] .a.b. [blank]
sName - the simple or qualified name of the class (or package)
public static java.lang.String getQualifiedName(java.lang.String pkg,
java.lang.String sName)
pkg - package namesName - simple class name
public static java.lang.String getCompositePackage(java.lang.String pkg1,
java.lang.String pkg2)
pkg1 pkg2 composite ----------- -------------- ---------------------- [blank] [blank] [blank] [blank] yourpkg. yourpkg. [blank] .yourpkg. .yourpkg. mypkg. [blank] mypkg. .mypkg. [blank] .mypkg. mypkg. yourpkg. yourpkg. mypkg. .yourpkg. mypkg.yourpkg. .mypkg. .yourpkg. .mypkg.yourpkg.
pkg1 - the first (base) packagepkg2 - the second (extending/overriding) package
public static java.lang.String getCompositeName(java.lang.Class clz,
java.lang.String sName)
clz - the existing classsName - the name to use to build the composite class name
public static java.lang.String getCompositeName(java.lang.String sName1,
java.lang.String sName2)
Class Name Derived ----------- -------------- ---------------------- Test Net Net mypkg.Test Net mypkg.Net mypkg.Test yourpkg. yourpkg.Test mypkg.Test .yourpkg mypkg.yourpkg.Test mypkg.Test .yourpkg. mypkg.yourpkg.Test mypkg.Test yourpkg.Net yourpkg.Net mypkg.Test .yourpkg.Net mypkg.yourpkg.Net mypkg.Test .yourpkg.Net. mypkg.yourpkg.Net.Test
sName1 - the existing class namesName2 - the name to use to build the composite class name
public static java.lang.String getDerivedName(java.lang.Class clz,
java.lang.String sPrefix)
clz - the existing classsPrefix - the prefix to apply to the existing class to determine the name of the "derived" class
public static java.lang.String getDerivedName(java.lang.String sName,
java.lang.String sPrefix)
Class Prefix Derived ----------- ------------- ---------------------- Test Net NetTest mypkg.Test Net mypkg.NetTest mypkg.Test yourpkg. yourpkg.Test mypkg.Test .yourpkg mypkg.yourpkg.Test mypkg.Test .yourpkg. mypkg.yourpkg.Test mypkg.Test yourpkg.Net yourpkg.NetTest mypkg.Test .yourpkg.Net mypkg.yourpkg.NetTest mypkg.Test .yourpkg.Net. mypkg.yourpkg.Net.Test
sName - the existing class namesPrefix - the prefix to apply to the existing class to determine the name of the "derived" classpublic static boolean isPartialNameLegal(java.lang.String sName)
sName - the partial namepublic static boolean isSimpleNameLegal(java.lang.String sName)
sName - the string containing the namepublic static boolean isQualifiedNameLegal(java.lang.String sName)
sName - the string containing the dot-delimited identifier
public static Resources getPackageResources(java.lang.String sClass)
throws java.util.MissingResourceException
sClass - the class name (fully qualified) to get the resources forjava.util.MissingResourceExceptiongetResources(java.lang.Class, java.lang.String)
public static Resources getPackageResources(java.lang.Class clz)
throws java.util.MissingResourceException
clz - the class to get the resources forjava.util.MissingResourceExceptiongetResources(java.lang.Class, java.lang.String)
public static Resources getResources(java.lang.Class clz,
java.lang.String sName)
throws java.util.MissingResourceException
clz - the class to get the resources forsName - the name of the resource classjava.util.MissingResourceException
public static java.lang.Object newInstance(java.lang.Class clz,
java.lang.Object[] aoParam)
throws java.lang.InstantiationException,
java.lang.reflect.InvocationTargetException
clz - the class to instantiateaoParam - the constructor parametersjava.lang.InstantiationException - if an exception is raised trying to instantiate the object, whether the exception is a security, method access, no such method, or instantiation exceptionjava.lang.reflect.InvocationTargetException - if the constructor of the new object instance raises an exception
public static java.lang.Object invokeStatic(java.lang.Class clz,
java.lang.String sName,
java.lang.Object[] aoParam)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
clz - the class to invoke the static method ofsName - the method nameaoParam - the method argumentsjava.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
public static java.lang.Object invoke(java.lang.Object obj,
java.lang.String sName,
java.lang.Object[] aoParam)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
obj - the object to invoke the instance method ofsName - the method nameaoParam - the method argumentsjava.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
public static java.lang.Object invoke(java.lang.Class clz,
java.lang.Object obj,
java.lang.String sName,
java.lang.Object[] aoParam)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
clz - the class to invoke the method onobj - the object to invoke the method onsName - the method nameaoParam - the method argumentsjava.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
public static java.lang.reflect.Method findMethod(java.lang.Class clz,
java.lang.String sName,
java.lang.Class[] aclzParam,
boolean fStatic)
clz - the class referencesName - the method nameaclzParam - the parameter types (some array elements could be null)fStatic - the method scope flag
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||