Class ObjectType
java.lang.Object
org.apache.bcel.generic.Type
org.apache.bcel.generic.ReferenceType
org.apache.bcel.generic.ObjectType
Denotes reference such as
String.-
Field Summary
Fields inherited from class Type
BOOLEAN, BYTE, CHAR, CLASS, DOUBLE, FLOAT, INT, LONG, NO_ARGS, NULL, OBJECT, SHORT, signature, STRING, STRINGBUFFER, THROWABLE, type, UNKNOWN, VOIDModifier and TypeFieldDescriptionstatic final BasicTypePredefined constant for boolean type.static final BasicTypePredefined constant for byte type.static final BasicTypePredefined constant for char type.static final ObjectTypePredefined constant for Class type.static final BasicTypePredefined constant for double type.static final BasicTypePredefined constant for float type.static final BasicTypePredefined constant for int type.static final BasicTypePredefined constant for long type.static final Type[]Empty array.static final ReferenceTypePredefined constant for null type.static final ObjectTypePredefined constant for Object type.static final BasicTypePredefined constant for short type.protected StringDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final ObjectTypePredefined constant for String type.static final ObjectTypePredefined constant for StringBuffer type.static final ObjectTypePredefined constant for Throwable type.protected byteDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final TypePredefined constant for unknown type.static final BasicTypePredefined constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccessibleTo(ObjectType accessor) Java Virtual Machine Specification edition 2, 5.4.4 Access Control.booleanGets the name of the referenced class.static ObjectTypegetInstance(String className) Gets a new instance.inthashCode()Gets the hash code.booleanDeprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesClassExact() insteadbooleanReturn true if this type references a class, false if it references an interface.booleanDeprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesInterfaceExact() insteadbooleanReturn true if this type references an interface, false if it references a class.booleansubclassOf(ObjectType superclass) Return true if this type is a subclass of given ObjectType.toString()Return the string representation of this type.Methods inherited from class ReferenceType
firstCommonSuperclass, getFirstCommonSuperclass, isAssignmentCompatibleWith, isCastableToModifier and TypeMethodDescriptionDeprecated.Use getFirstCommonSuperclass(ReferenceType t) which has slightly changed semantics.Gets the first common superclass (narrowest ReferenceType referencing a class, not an interface).booleanTests whether this type is assignment compatible with another type t as defined in the JVM specification; see the AASTORE definition there.booleanisCastableTo(Type t) Tests whether this type is castable to another type t as defined in the JVM specification.Methods inherited from class Type
getArgumentTypes, getMethodSignature, getReturnType, getSignature, getSignature, getSize, getType, getType, getType, getTypes, normalizeForStackOrLocalModifier and TypeMethodDescriptionstatic Type[]getArgumentTypes(String signature) Gets the argument types of a method from its signature as an array of Type objects.static StringgetMethodSignature(Type returnType, Type[] argTypes) Gets the Java method signature for the given types, for example, int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I.static TypegetReturnType(String signature) Gets the return type of a method from its signature as a Type object.Gets the signature for this type.static StringgetSignature(Method meth) Gets the signature for a method.intgetSize()Gets the stack size of this type.bytegetType()Gets the type as defined in Constants.static TypeGets the BCEL Type object corresponding to a runtimeClass.static TypeGets the Type object corresponding to a signature.static Type[]Gets the BCEL Type objects corresponding to an array of runtime classes.boolean, short and char variable are considered as int in the stack or local variable area.
-
Constructor Details
-
ObjectType
Constructs a new instance.- Parameters:
className- fully qualified class name, for exampleString.
-
-
Method Details
-
getInstance
Gets a new instance.- Parameters:
className- fully qualified class name, for exampleString.- Returns:
- A new instance.
- Since:
- 6.0
-
accessibleTo
Java Virtual Machine Specification edition 2, 5.4.4 Access Control.- Parameters:
accessor- The accessing type.- Returns:
- true if accessible.
- Throws:
ClassNotFoundException- Thrown if the class referenced by this type can't be found.
-
equals
-
getClassName
Gets the name of the referenced class.- Overrides:
getClassNamein classType- Returns:
- name of referenced class.
-
hashCode
-
referencesClass
Deprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesClassExact() insteadIf "this" doesn't reference a class, it references an interface or a nonexistent entity.- Returns:
- true if it references a class, false otherwise.
-
referencesClassExact
Return true if this type references a class, false if it references an interface.- Returns:
- true if the type references a class, false if it references an interface.
- Throws:
ClassNotFoundException- Thrown if the class or interface referenced by this type can't be found
-
referencesInterface
Deprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesInterfaceExact() insteadIf "this" doesn't reference an interface, it references a class or a nonexistent entity.- Returns:
- true if it references an interface, false otherwise.
-
referencesInterfaceExact
Return true if this type references an interface, false if it references a class.- Returns:
- true if the type references an interface, false if it references a class.
- Throws:
ClassNotFoundException- Thrown if the class or interface referenced by this type can't be found
-
subclassOf
Return true if this type is a subclass of given ObjectType.- Parameters:
superclass- The superclass to check against.- Returns:
- true if this is a subclass.
- Throws:
ClassNotFoundException- Thrown if any of this class's superclasses can't be found.
-
toString
-