|
S-PLUS Connect/Java v1.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.insightful.splus.util.ClassUtilities
public class ClassUtilities
Class with static methods for doing Class, Method, and Field operations. If the class name is in JNI format such as "java/lang/Math" it will be converted to the Java format such as "java.lang.Math".
ClientUtilities
,
ClientUtilitiesImpl
,
ClientUtilitiesReceiver
Field Summary | |
---|---|
static boolean |
testFieldBoolean
fields and methods for testing .JavaMethod and .JavaField |
static boolean[] |
testFieldBooleanArray
|
static byte |
testFieldByte
|
static byte[] |
testFieldByteArray
|
static char |
testFieldChar
|
static char[] |
testFieldCharArray
|
static double |
testFieldDouble
|
static double[] |
testFieldDoubleArray
|
static float |
testFieldFloat
|
static float[] |
testFieldFloatArray
|
static int |
testFieldInt
|
static int[] |
testFieldIntArray
|
static long |
testFieldLong
|
static long[] |
testFieldLongArray
|
static Object |
testFieldObject
|
static Object[] |
testFieldObjectArray
|
static short |
testFieldShort
|
static short[] |
testFieldShortArray
|
static String |
testFieldString
|
static String[] |
testFieldStringArray
|
Method Summary | |
---|---|
static void |
attachClassPath(String classPath)
Add a class loader for the specified class path to the class loader search list. |
static void |
attachClassPath(String[] classPaths)
Add a class loader for the specified class paths to the class loader search list. |
static void |
attachClassPath(URL[] urlList)
Add a class loader for the specified URLs to the class loader search list. |
static int |
availableProcessors()
|
static boolean |
classExists(String className)
Test whether a class exists. |
static boolean |
fieldExists(String className,
String fieldName)
Test whether a field exists. |
static double |
freeMemory()
|
static Class |
getClassForName(String name)
Return the class for a given class name, using the current classloader. |
static ClassLoader |
getClassLoader()
Return the current class loader used for mapping from names to classes. |
static String[] |
getPropertiesAsStringArray()
|
static Object |
getStaticFieldValue(String className,
String fieldName)
Get the value of a static field. |
static Object |
invokeStaticMethod(String className,
String methodName)
Invoke a static method that has no arguments. |
static Object |
invokeStaticMethod(String className,
String methodName,
Class[] parameterTypes,
Object[] args)
Invoke a static method. |
static double |
maxMemory()
static methods to access Runtime instance mts from .JavaMethod |
static boolean |
methodExists(String className,
String methodName,
Class[] parameterTypes)
Test whether a method exists. |
static Object |
newInstance(String className)
Create a new instance of an object using the no-argument constructor. |
static void |
setClassLoader(ClassLoader loader)
Set the current class loader used for mapping from names to classes. |
static double |
testLoop(int size,
int size2,
boolean useDoubles,
boolean doYield)
|
static double |
testLoop(int size,
int size2,
int sleep,
boolean useDoubles)
|
static double |
testLoopDouble(int size)
|
static double |
testLoopDouble2(int size,
int size2)
|
static int |
testLoopInt(int size)
|
static int |
testLoopInt2(int size,
int size2)
|
static boolean |
testMethodBoolean()
|
static boolean[] |
testMethodBooleanArray()
|
static byte |
testMethodByte()
|
static byte[] |
testMethodByteArray()
|
static char |
testMethodChar()
|
static char[] |
testMethodCharArray()
|
static double |
testMethodDouble()
|
static double[] |
testMethodDoubleArray()
|
static float |
testMethodFloat()
|
static float[] |
testMethodFloatArray()
|
static int |
testMethodInt()
|
static int[] |
testMethodIntArray()
|
static long |
testMethodLong()
|
static long[] |
testMethodLongArray()
|
static Object |
testMethodObject()
|
static Object[] |
testMethodObjectArray()
|
static void |
testMethodSetBoolean(boolean val)
|
static void |
testMethodSetBooleanArray(boolean[] val)
|
static void |
testMethodSetByte(byte val)
|
static void |
testMethodSetByteArray(byte[] val)
|
static void |
testMethodSetChar(char val)
|
static void |
testMethodSetCharArray(char[] val)
|
static void |
testMethodSetDouble(double val)
|
static void |
testMethodSetDoubleArray(double[] val)
|
static void |
testMethodSetFloat(float val)
|
static void |
testMethodSetFloatArray(float[] val)
|
static void |
testMethodSetInt(int val)
|
static void |
testMethodSetIntArray(int[] val)
|
static void |
testMethodSetLong(long val)
|
static void |
testMethodSetLongArray(long[] val)
|
static void |
testMethodSetShort(short val)
|
static void |
testMethodSetShortArray(short[] val)
|
static void |
testMethodSetString(String val)
|
static void |
testMethodSetStringArray(String[] val)
|
static short |
testMethodShort()
|
static short[] |
testMethodShortArray()
|
static String |
testMethodString()
|
static String[] |
testMethodStringArray()
|
static double |
totalMemory()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean testFieldBoolean
public static byte testFieldByte
public static char testFieldChar
public static short testFieldShort
public static int testFieldInt
public static long testFieldLong
public static float testFieldFloat
public static double testFieldDouble
public static String testFieldString
public static Object testFieldObject
public static boolean[] testFieldBooleanArray
public static byte[] testFieldByteArray
public static char[] testFieldCharArray
public static short[] testFieldShortArray
public static int[] testFieldIntArray
public static long[] testFieldLongArray
public static float[] testFieldFloatArray
public static double[] testFieldDoubleArray
public static String[] testFieldStringArray
public static Object[] testFieldObjectArray
Method Detail |
---|
public static Object getStaticFieldValue(String className, String fieldName) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
className
- The class containing the field of interest.fieldName
- The field of interest.
ClassNotFoundException
NoSuchFieldException
IllegalAccessException
Class.getField(String name)
public static Object invokeStaticMethod(String className, String methodName, Class[] parameterTypes, Object[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
If parameterTypes is null, the classes of args will be used to construct the Class [] array. This means that a method whose signature does not match the specific object types will not be found.
className
- The class containing the method to invoke.methodName
- The method to invoke.parameterTypes
- Array of Class objects matching the arguments
to the method. The class for a primitive argument such as
"double" is obtained from the wrapper class "Double" using the
static field "Double.TYPE".args
- Array of arguments to the method. Primitive arguments
such as "double" must be wrapped in an object such as "Double".
ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
Method.invoke(Object obj, Object [] args)
public static Object invokeStaticMethod(String className, String methodName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
public static Object newInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException
className
- Class of the object.
ClassNotFoundException
IllegalAccessException
InstantiationException
Class.newInstance()
public static boolean classExists(String className)
className
- Class to find.
public static boolean fieldExists(String className, String fieldName) throws SecurityException
className
- The class containing the field of interest.fieldName
- The field of interest.
SecurityException
public static boolean methodExists(String className, String methodName, Class[] parameterTypes)
className
- The class containing the method.methodName
- The method.parameterTypes
- Array of Class objects matching the arguments
to the method. The class for a primitive argument such as
"double" is obtained from the wrapper class "Double" using the
static field "Double.TYPE".
public static Class getClassForName(String name) throws ClassNotFoundException
name
- The class containing the method.
ClassNotFoundException
public static void attachClassPath(String classPath) throws Exception
classPath
- a jar file or a directory containing classes.
Exception
public static void attachClassPath(String[] classPaths) throws Exception
classPaths
- an array of jar files and class directories.
Exception
public static void attachClassPath(URL[] urlList) throws Exception
urlList
- an array of URLs for jar files and class directories.
Exception
public static ClassLoader getClassLoader()
public static void setClassLoader(ClassLoader loader)
loader
- the new class loader.public static boolean testMethodBoolean()
public static byte testMethodByte()
public static char testMethodChar()
public static short testMethodShort()
public static int testMethodInt()
public static long testMethodLong()
public static float testMethodFloat()
public static double testMethodDouble()
public static String testMethodString()
public static Object testMethodObject()
public static boolean[] testMethodBooleanArray()
public static byte[] testMethodByteArray()
public static char[] testMethodCharArray()
public static short[] testMethodShortArray()
public static int[] testMethodIntArray()
public static long[] testMethodLongArray()
public static float[] testMethodFloatArray()
public static double[] testMethodDoubleArray()
public static String[] testMethodStringArray()
public static Object[] testMethodObjectArray()
public static void testMethodSetInt(int val)
public static void testMethodSetBoolean(boolean val)
public static void testMethodSetByte(byte val)
public static void testMethodSetChar(char val)
public static void testMethodSetShort(short val)
public static void testMethodSetLong(long val)
public static void testMethodSetFloat(float val)
public static void testMethodSetDouble(double val)
public static void testMethodSetString(String val)
public static void testMethodSetBooleanArray(boolean[] val)
public static void testMethodSetByteArray(byte[] val)
public static void testMethodSetCharArray(char[] val)
public static void testMethodSetShortArray(short[] val)
public static void testMethodSetIntArray(int[] val)
public static void testMethodSetLongArray(long[] val)
public static void testMethodSetFloatArray(float[] val)
public static void testMethodSetDoubleArray(double[] val)
public static void testMethodSetStringArray(String[] val)
public static String[] getPropertiesAsStringArray()
public static int testLoopInt(int size)
public static int testLoopInt2(int size, int size2)
public static double testLoopDouble(int size)
public static double testLoopDouble2(int size, int size2)
public static double testLoop(int size, int size2, boolean useDoubles, boolean doYield)
public static double testLoop(int size, int size2, int sleep, boolean useDoubles)
public static double maxMemory()
public static double totalMemory()
public static double freeMemory()
public static int availableProcessors()
|
S-PLUS Connect/Java v1.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |