Package org.apache.bcel.generic
Class ObjectType
- java.lang.Object
-
- org.apache.bcel.generic.Type
-
- org.apache.bcel.generic.ReferenceType
-
- org.apache.bcel.generic.ObjectType
-
public class ObjectType extends ReferenceType
Denotes reference such asString.
-
-
Constructor Summary
Constructors Constructor Description ObjectType(java.lang.String className)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaccessibleTo(ObjectType accessor)Java Virtual Machine Specification edition 2, 5.4.4 Access Control.booleanequals(java.lang.Object type)java.lang.StringgetClassName()Gets the class name.static ObjectTypegetInstance(java.lang.String className)Constructs a new instance.inthashCode()Gets the hash code.booleanreferencesClass()Deprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesClassExact() insteadbooleanreferencesClassExact()Return true if this type references a class, false if it references an interface.booleanreferencesInterface()Deprecated.(since 6.0) this method returns an inaccurate result if the class or interface referenced cannot be found: use referencesInterfaceExact() insteadbooleanreferencesInterfaceExact()Return 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.-
Methods inherited from class org.apache.bcel.generic.ReferenceType
firstCommonSuperclass, getFirstCommonSuperclass, isAssignmentCompatibleWith, isCastableTo
-
Methods inherited from class org.apache.bcel.generic.Type
getArgumentTypes, getMethodSignature, getReturnType, getSignature, getSignature, getSize, getType, getType, getType, getTypes, normalizeForStackOrLocal, toString
-
-
-
-
Constructor Detail
-
ObjectType
public ObjectType(java.lang.String className)
Constructs a new instance.- Parameters:
className- fully qualified class name, for exampleString.
-
-
Method Detail
-
getInstance
public static ObjectType getInstance(java.lang.String className)
Constructs a new instance.- Parameters:
className- fully qualified class name, for exampleString.- Returns:
- A new instance.
- Since:
- 6.0
-
accessibleTo
public boolean accessibleTo(ObjectType accessor) throws java.lang.ClassNotFoundException
Java Virtual Machine Specification edition 2, 5.4.4 Access Control.- Parameters:
accessor- The accessing type.- Returns:
- true if accessible.
- Throws:
java.lang.ClassNotFoundException- Thrown if the class referenced by this type can't be found.
-
equals
public boolean equals(java.lang.Object type)
-
getClassName
public java.lang.String getClassName()
Description copied from class:TypeGets the class name.- Overrides:
getClassNamein classType- Returns:
- name of referenced class.
-
hashCode
public int hashCode()
Gets the hash code.
-
referencesClass
@Deprecated public boolean 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 non-existant entity.- Returns:
- true if it references a class, false otherwise.
-
referencesClassExact
public boolean referencesClassExact() throws java.lang.ClassNotFoundException
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:
java.lang.ClassNotFoundException- Thrown if the class or interface referenced by this type can't be found
-
referencesInterface
@Deprecated public boolean 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 non-existant entity.- Returns:
- true if it references an interface, false otherwise.
-
referencesInterfaceExact
public boolean referencesInterfaceExact() throws java.lang.ClassNotFoundException
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:
java.lang.ClassNotFoundException- Thrown if the class or interface referenced by this type can't be found
-
subclassOf
public boolean subclassOf(ObjectType superclass) throws java.lang.ClassNotFoundException
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:
java.lang.ClassNotFoundException- Thrown if any of this class's superclasses can't be found.
-
-