| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| private static Vector | addCandidates(Method[] methods, String methodName, int numArgs, boolean publicOnly, Vector<E> candidates)
|
| private static ReflectError | |
| private static void | |
| pack-priv static Object | constructObject(Class<T> clas, Object[] args)
Primary object constructor This method is simpler than those that must resolve general method invocation because constructors are not inherited. |
| private static Field | Returns: the Field or throws NoSuchFieldExceptionUsed when accessibility capability is available to locate an occurrance of the field in the most derived class or superclass and set its accessibility flag. |
| pack-priv static Constructor | |
| pack-priv static int | |
| pack-priv static Method | findMostSpecificMethod(Class<T>[] idealMatch, Method[]
the set of candidate method which differ only in the
types of their arguments. methods)Find the best match for signature idealMatch. |
| pack-priv static int | Returns: the index of the most specific candidateImplement JLS 15.11.2 Return the index of the most specific arguments match or -1 if no match is found. |
| private static Method | Returns: the method or null for not foundGet the candidate methods by searching the class and interface graph of baseClass and resolve the most specific. |
| private static Vector | Returns: the candidate methods vectorAccumulate all methods, optionally including non-public methods, class and interface, in the inheritence tree of baseClass. |
| public static Class | |
| public static int | getArrayDimensions(Class<T> arrayClass)
returns the dimensionality of the Class returns 0 if the Class is not an array class |
| pack-priv static Method[] | getCandidateMethods(Class<T> baseClass, String methodName, int numArgs, boolean publicOnly)
Climb the class and interface inheritence graph of the type and collect all methods matching the specified name and criterion. |
| private static Object | |
| public static Object | |
| pack-priv static LHS | |
| pack-priv static LHS | |
| public static Object | |
| public static Object | |
| public static Object | |
| public static boolean | |
| public static boolean | |
| public static Object | invokeCompiledCommand(Class<T> commandClass, Object[] args, Interpreter interpreter, CallStack callstack)
A command may be implemented as a compiled Java class containing one or more static invoke() methods of the correct signature. |
| pack-priv static Object | invokeMethod(Method method, Object object, Object[]
may be null args)Invoke the Java method on the specified object, performing needed type mappings on arguments and return values. |
| public static Object | Returns: the result of the method callInvoke method on arbitrary object instance. |
| public static Object | invokeStaticMethod(BshClassManager bcm, Class<T> clas, String methodName, Object[] args)
Invoke a method known to be static. |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static void | |
| public static String | |
| protected static Field | |
| protected static Method | resolveExpectedJavaMethod(BshClassManager bcm, Class<T> clas, Object object, String name, Object[] args, boolean staticOnly)
This method wraps resolveJavaMethod() and expects a non-null method result. |
| protected static Field | |
| protected static Method | Returns: the method or null if no matching method was found.The method located must be static, the object param may be null. staticOnly)The full blown resolver method. |
| public static void | |
| public static void |
| Reflect | back to summary |
|---|---|
| pack-priv Reflect() | |
| accessorName | back to summary |
|---|---|
| private static String accessorName(String getorset, String propName) | |
| addCandidates | back to summary |
|---|---|
| private static Vector | |
| cantFindConstructor | back to summary |
|---|---|
| private static ReflectError cantFindConstructor(Class<T> clas, Class<T>[] types) | |
| checkFoundStaticMethod | back to summary |
|---|---|
| private static void checkFoundStaticMethod(Method method, boolean staticOnly, Class<T> clas) throws UtilEvalError | |
| constructObject | back to summary |
|---|---|
| pack-priv static Object constructObject(Class<T> clas, Object[] args) throws ReflectError, InvocationTargetException Primary object constructor This method is simpler than those that must resolve general method invocation because constructors are not inherited. This method determines whether to attempt to use non-public constructors based on Capabilities.haveAccessibility() and will set the accessibilty flag on the method as necessary.
| |
| findAccessibleField | back to summary |
|---|---|
| private static Field findAccessibleField(Class<T> clas, String fieldName) throws UtilEvalError, NoSuchFieldException Used when accessibility capability is available to locate an occurrance of the field in the most derived class or superclass and set its accessibility flag. Note that this method is not needed in the simple non accessible case because we don't have to hunt for fields. Note that classes may declare overlapping private fields, so the distinction about the most derived is important. Java doesn't normally allow this kind of access (super won't show private variables) so there is no real syntax for specifying which class scope to use...
| |
| findMostSpecificConstructor | back to summary |
|---|---|
| pack-priv static Constructor | |
| findMostSpecificConstructorIndex | back to summary |
|---|---|
| pack-priv static int findMostSpecificConstructorIndex(Class<T>[] idealMatch, Constructor<T>[] constructors) | |
| findMostSpecificMethod | back to summary |
|---|---|
| pack-priv static Method findMostSpecificMethod(Class<T>[] idealMatch, Method[] methods) Find the best match for signature idealMatch. It is assumed that the methods array holds only valid candidates (e.g. method name and number of args already matched). This method currently does not take into account Java 5 covariant return types... which I think will require that we find the most derived return type of otherwise identical best matches.
| |
| findMostSpecificSignature | back to summary |
|---|---|
| pack-priv static int findMostSpecificSignature(Class<T>[] idealMatch, Class<T>[][] candidates) Implement JLS 15.11.2 Return the index of the most specific arguments match or -1 if no match is found. This method is used by both methods and constructors (which unfortunately don't share a common interface for signature info).
| |
| findOverloadedMethod | back to summary |
|---|---|
| private static Method findOverloadedMethod(Class<T> baseClass, String methodName, Class<T>[] types, boolean publicOnly) Get the candidate methods by searching the class and interface graph of baseClass and resolve the most specific.
| |
| gatherMethodsRecursive | back to summary |
|---|---|
| private static Vector Accumulate all methods, optionally including non-public methods, class and interface, in the inheritence tree of baseClass. This method is analogous to Class getMethods() which returns all public methods in the inheritence tree. In the normal (non-accessible) case this also addresses the problem that arises when a package private class or private inner class implements a public interface or derives from a public type. In other words, sometimes we'll find public methods that we can't use directly and we have to find the same public method in a parent class or interface.
| |
| getArrayBaseType | back to summary |
|---|---|
| public static Class Returns the base type of an array Class. throws ReflectError if the Class is not an array class. | |
| getArrayDimensions | back to summary |
|---|---|
| public static int getArrayDimensions(Class<T> arrayClass) returns the dimensionality of the Class returns 0 if the Class is not an array class | |
| getCandidateMethods | back to summary |
|---|---|
| pack-priv static Method[] getCandidateMethods(Class<T> baseClass, String methodName, int numArgs, boolean publicOnly) Climb the class and interface inheritence graph of the type and collect all methods matching the specified name and criterion. If publicOnly is true then only public methods in *public* classes or interfaces will be returned. In the normal (non-accessible) case this addresses the problem that arises when a package private class or private inner class implements a public interface or derives from a public type. This method primarily just delegates to gatherMethodsRecursive() | |
| getFieldValue | back to summary |
|---|---|
| private static Object getFieldValue(Class<T> clas, Object object, String fieldName, boolean staticOnly) throws UtilEvalError, ReflectError | |
| getIndex | back to summary |
|---|---|
| public static Object getIndex(Object array, int index) throws ReflectError, UtilTargetError | |
| getLHSObjectField | back to summary |
|---|---|
| pack-priv static LHS getLHSObjectField(Object object, String fieldName) throws UtilEvalError, ReflectError Get an LHS reference to an object field. This method also deals with the field style property access. In the field does not exist we check for a property setter. | |
| getLHSStaticField | back to summary |
|---|---|
| pack-priv static LHS getLHSStaticField(Class<T> clas, String fieldName) throws UtilEvalError, ReflectError | |
| getObjectFieldValue | back to summary |
|---|---|
| public static Object getObjectFieldValue(Object object, String fieldName) throws UtilEvalError, ReflectError | |
| getObjectProperty | back to summary |
|---|---|
| public static Object getObjectProperty(Object obj, String propName) throws UtilEvalError, ReflectError | |
| getStaticFieldValue | back to summary |
|---|---|
| public static Object getStaticFieldValue(Class<T> clas, String fieldName) throws UtilEvalError, ReflectError | |
| hasObjectPropertyGetter | back to summary |
|---|---|
| public static boolean hasObjectPropertyGetter(Class<T> clas, String propName) | |
| hasObjectPropertySetter | back to summary |
|---|---|
| public static boolean hasObjectPropertySetter(Class<T> clas, String propName) | |
| invokeCompiledCommand | back to summary |
|---|---|
| public static Object invokeCompiledCommand(Class<T> commandClass, Object[] args, Interpreter interpreter, CallStack callstack) throws UtilEvalError A command may be implemented as a compiled Java class containing one or more static invoke() methods of the correct signature. The invoke() methods must accept two additional leading arguments of the interpreter and callstack, respectively. e.g. invoke(interpreter, callstack, ... ) This method adds the arguments and invokes the static method, returning the result. | |
| invokeMethod | back to summary |
|---|---|
| pack-priv static Object invokeMethod(Method method, Object object, Object[] args) throws ReflectError, InvocationTargetException Invoke the Java method on the specified object, performing needed type mappings on arguments and return values.
| |
| invokeObjectMethod | back to summary |
|---|---|
| public static Object invokeObjectMethod(Object object, String methodName, Object[] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo) throws ReflectError, EvalError, InvocationTargetException Invoke method on arbitrary object instance. invocation may be static (through the object instance) or dynamic. Object may be a bsh scripted object (bsh.This type).
| |
| invokeStaticMethod | back to summary |
|---|---|
| public static Object invokeStaticMethod(BshClassManager bcm, Class<T> clas, String methodName, Object[] args) throws ReflectError, UtilEvalError, InvocationTargetException Invoke a method known to be static. No object instance is needed and there is no possibility of the method being a bsh scripted method. | |
| isPublic | back to summary |
|---|---|
| private static boolean isPublic(Class<T> c) | |
| isPublic | back to summary |
|---|---|
| private static boolean isPublic(Method m) | |
| isPublic | back to summary |
|---|---|
| private static boolean isPublic(Constructor<T> c) | |
| isStatic | back to summary |
|---|---|
| private static boolean isStatic(Method m) | |
| logInvokeMethod | back to summary |
|---|---|
| private static void logInvokeMethod(String msg, Method method, Object[] args) | |
| normalizeClassName | back to summary |
|---|---|
| public static String normalizeClassName(Class<T> type) Return a more human readable version of the type name. Specifically, array types are returned with postfix "[]" dimensions. e.g. return "int []" for integer array instead of "class [I" as would be returned by Class getName() in that case. | |
| resolveExpectedJavaField | back to summary |
|---|---|
protected static Field resolveExpectedJavaField(Class<T> clas, String fieldName, boolean staticOnly) throws UtilEvalError, ReflectError
| |
| resolveExpectedJavaMethod | back to summary |
|---|---|
| protected static Method resolveExpectedJavaMethod(BshClassManager bcm, Class<T> clas, Object object, String name, Object[] args, boolean staticOnly) throws ReflectError, UtilEvalError This method wraps resolveJavaMethod() and expects a non-null method result. If the method is not found it throws a descriptive ReflectError. | |
| resolveJavaField | back to summary |
|---|---|
| protected static Field resolveJavaField(Class<T> clas, String fieldName, boolean staticOnly) throws UtilEvalError | |
| resolveJavaMethod | back to summary |
|---|---|
| protected static Method resolveJavaMethod(BshClassManager bcm, Class<T> clas, String name, Class<T>[] types, boolean staticOnly) throws UtilEvalError The full blown resolver method. All other method invocation methods delegate to this. The method may be static or dynamic unless staticOnly is set (in which case object may be null). If staticOnly is set then only static methods will be located. This method performs caching (caches discovered methods through the class manager and utilizes cached methods.) This method determines whether to attempt to use non-public methods based on Capabilities.haveAccessibility() and will set the accessibilty flag on the method as necessary. If, when directed to find a static method, this method locates a more specific matching instance method it will throw a descriptive exception analogous to the error that the Java compiler would produce. Note as of 2.0.x this is a problem because there is no way to work around this with a cast.
| |
| setIndex | back to summary |
|---|---|
| public static void setIndex(Object array, int index, Object val) throws ReflectError, UtilTargetError | |
| setObjectProperty | back to summary |
|---|---|
| public static void setObjectProperty(Object obj, String propName, Object value) throws ReflectError, UtilEvalError | |