| java.lang.Object org.apache.derby.iapi.services.loader.ClassInspector
ClassInspector | final public class ClassInspector (Code) | | Methods to find out relationships between classes and methods within a class.
All class names within this interface are treated as java language class names,
e.g. int, COM.foo.Myclass, int[], java.lang.Object[]. That is java internal
class names as defined in the class file format are not understood.
|
Method Summary | |
public boolean | accessible(String className) | public boolean | assignableTo(String fromClassName, String toClassName) | protected boolean | classConvertableFromTo(Class fromClass, Class toClass, boolean mixTypes) Can we convert a fromClass to toClass. | public static boolean | classIsLoadable(String className) Determine whether or not the received class can be
loaded. | public Member | findPublicConstructor(String receiverType, String[] parmTypes, String[] primParmTypes, boolean[] isParam) Find a public constructor that implements a given signature.
The signature is given using the full Java class names of the types.
A untyped null paramter is indicated by passing in an empty string ("")
as its class name. | public Member | findPublicField(String receiverType, String fieldName, boolean staticField) Find a public field for a class.
This follows the sematics of the java compiler for locating a field.
This means if a field fieldName exists in the class with package, private or
protected then an error is raised. | public Member | findPublicMethod(String receiverType, String methodName, String[] parmTypes, String[] primParmTypes, boolean[] isParam, boolean staticMethod, boolean repeatLastParameter) Find a public method that implements a given signature.
The signature is given using the full Java class names of the types.
A untyped null paramter is indicated by passing in an empty string ("")
as its class name.
If receiverType respresents an interface then the methods of java.lang.Object
arer included in the candidate list.
If the caller is simply checking to see that a public method with the
specified name exists, regardless of the signature, exists, then the
caller should pass in a null for parmTypes. | public Class | getClass(String className) Get (load) the class for the given class name.
This method converts any java language class name
into a Class object. | public String | getDeclaringClass(Member method) Get the declaring class for a method. | public String[] | getParameterTypes(Member method) Get the parameter types for a method described by a Member as a String[]. | public String | getType(Member member) Get the Java name of the return type from a Member representing
a method or the type of a Member representing a field. | public boolean | instanceOf(String className, Object obj) | public static boolean | primitiveType(String typeName) | public static String | readableClassName(Class clazz) Translate a JVM-style type descriptor to a Java-language-style type
name. |
ClassInspector | public ClassInspector(ClassFactory cf)(Code) | | DO NOT USE! use the method in ClassFactory.
|
accessible | public boolean accessible(String className) throws ClassNotFoundException(Code) | | Does the named class exist, and is it accessible?
Parameters: className - The name of the class to test for existence true if the class exists and is accessible, false if not |
assignableTo | public boolean assignableTo(String fromClassName, String toClassName)(Code) | | Is one named class assignable to another named class or interface?
Parameters: fromClassName - The name of the class to be assigned Parameters: toClassName - The name of the class to be assigned to true if an object of type fromClass can be assigned to anobject of type toClass, false if not. |
classConvertableFromTo | protected boolean classConvertableFromTo(Class fromClass, Class toClass, boolean mixTypes)(Code) | | Can we convert a fromClass to toClass.
"mixTypes" is a flag to show if object/primitive type conversion is
possible; this is used for comparing two candidate methods in the
second pass of the two pass method resolution.
Parameters: fromClass - from class Parameters: toClass - to class Parameters: mixTypes - mixing object/primitive types for comparison |
classIsLoadable | public static boolean classIsLoadable(String className)(Code) | | Determine whether or not the received class can be
loaded.
Parameters: className - The name of the class in question True if className can be loaded, false otherwise |
findPublicConstructor | public Member findPublicConstructor(String receiverType, String[] parmTypes, String[] primParmTypes, boolean[] isParam) throws ClassNotFoundException, StandardException(Code) | | Find a public constructor that implements a given signature.
The signature is given using the full Java class names of the types.
A untyped null paramter is indicated by passing in an empty string ("")
as its class name.
Parameters: receiverType - The class name of the receiver Parameters: parmTypes - An array of class names representing theparameter types. Pass a zero-element array ifthere are no parameters. Parameters: primParmTypes - This is used in the second pass of the two-passmethod resolution algorithm. Use primitive typeif it has one, otherwise use same object type Parameters: isParam - Array of booleans telling whether parameter is a ?. A Member representing the matching constructor. Returns nullif no such constructor. exception: ClassNotFoundException - One or more of the classes doesnot exist. exception: StandardException - Thrown on ambiguous constructor invocation. See Also: Member See Also: Modifier |
findPublicField | public Member findPublicField(String receiverType, String fieldName, boolean staticField) throws StandardException(Code) | | Find a public field for a class.
This follows the sematics of the java compiler for locating a field.
This means if a field fieldName exists in the class with package, private or
protected then an error is raised. Even if the field hides a field fieldName
in a super-class/super--interface. See the JVM spec on fields.
Parameters: receiverType - The class name of the receiver Parameters: fieldName - The name of the field Parameters: staticField - Find a static field A Member representing the matching field. exception: StandardException - Class or field does not exist or is not public or a security exception. See Also: Member See Also: Modifier |
findPublicMethod | public Member findPublicMethod(String receiverType, String methodName, String[] parmTypes, String[] primParmTypes, boolean[] isParam, boolean staticMethod, boolean repeatLastParameter) throws ClassNotFoundException, StandardException(Code) | | Find a public method that implements a given signature.
The signature is given using the full Java class names of the types.
A untyped null paramter is indicated by passing in an empty string ("")
as its class name.
If receiverType respresents an interface then the methods of java.lang.Object
arer included in the candidate list.
If the caller is simply checking to see that a public method with the
specified name exists, regardless of the signature, exists, then the
caller should pass in a null for parmTypes. (This is useful for checking
the validity of a method alias when creating one.)
We use a two-pass algorithm to resolve methods. In the first pass, we
use all "object" types to try to match a method. If this fails, in the
second pass, an array of "primitive" types (if the parameter has one,
otherwise the same object type is used) is passed in, as well as the
"object" type array. For each parameter of a method, we try to match it
against either the "object" type, or the "primitive" type. Of all the
qualified candidate methods found, we choose the closest one to the input
parameter types. This involves comparing methods whose parameters are
mixed "object" and "primitive" types in the second pass. This is
eventually handled in classConvertableFromTo.
Parameters: receiverType - The class name of the receiver Parameters: methodName - The name of the method Parameters: parmTypes - An array of class names representing theparameter types. Pass a zero-element array ifthere are no parameters. Pass a null if it isokay to match any signature. Parameters: primParmTypes - This is used in the second pass of the two-passmethod resolution algorithm. Use primitive typeif it has one, otherwise use same object type Parameters: isParam - Array of booleans telling whether parameter is a ?. Parameters: staticMethod - Find a static method. Parameters: repeatLastParameter - If true the last parameter may be repeated any number of times (total count must be greater than one).If false the laste parameter is matched as usual. This also requires an exact match on the last parameter type. A Member representing the matching method. Returns nullif no such method. exception: ClassNotFoundException - One or more of the classes doesnot exist. exception: StandardException - Thrown on ambiguous method invocation. See Also: Member See Also: Modifier |
getClass | public Class getClass(String className) throws ClassNotFoundException(Code) | | Get (load) the class for the given class name.
This method converts any java language class name
into a Class object. This includes cases like String[]
and primitive types.
This will attempt to load the class from the application set.
exception: ClassNotFoundException - Class cannot be found, ora SecurityException or LinkageException was thrown loading the class. |
getDeclaringClass | public String getDeclaringClass(Member method)(Code) | | Get the declaring class for a method.
Parameters: method - A Member describing a method A String with the declaring class See Also: Member.getDeclaringClass |
getParameterTypes | public String[] getParameterTypes(Member method)(Code) | | Get the parameter types for a method described by a Member as a String[].
Parameters: method - A Member describing a method A String[] describing the parameters of the method |
getType | public String getType(Member member)(Code) | | Get the Java name of the return type from a Member representing
a method or the type of a Member representing a field.
Parameters: member - A Member representing the method forwhich we want the return type. A Java-language-style string describing the return type ofthe method (for example, it returns "int" instead of "I". |
instanceOf | public boolean instanceOf(String className, Object obj) throws ClassNotFoundException(Code) | | Is the given object an instance of the named class?
Parameters: className - The name of the class Parameters: obj - The object to test to see if it's an instanceof the named class true if obj is an instanceof className, false if not |
primitiveType | public static boolean primitiveType(String typeName)(Code) | | Determine whether a type is a Java primitive, like int or boolean
Parameters: typeName - The name of the Java type true if it's a primitive type |
readableClassName | public static String readableClassName(Class clazz)(Code) | | Translate a JVM-style type descriptor to a Java-language-style type
name.
Parameters: clazz - The String that contains the JVM type name The Java-language-style type name |
|
|