Package serp.bytecode
Class BCClass
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Annotated
serp.bytecode.BCClass
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
The BCClass represents a class object in the bytecode framework, in many
ways mirroring the
Class
class of Java reflection. The represented
class might be a primitive, array, existing object type, or some new user-
defined type. As with most entities in the bytecode framework, the BCClass
contains methods to manipulate the low-level state of the class (constant
pool indexes, etc), but these can and should be ignored in
favor of the available high-level methods.
A BCClass instance is loaded from a Project
and remains
attached to that project for its lifetime. If a BCClass is removed from
its project, the result of any further operations on the class are
undefined.
Note that if a BCClass represents a primitive or array type, all of the
available mutator methods and any methods that access the constant pool
will throw UnsupportedOperationException
s.
- Author:
- Abe White
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(BCVisitor visit) Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.Convenience method to add a default constructor to this class.void
Clear all fields from this class.void
Clear this class of all interface declarations.void
Clear all declared methods from this class.declareField
(String name, Class type) Add a field to this class.declareField
(String name, String type) Add a field to this class.declareField
(String name, BCClass type) Add a field to this class.declareField
(BCField field) Import the information from given field as a new field in this class.void
declareInterface
(Class type) Add an interface to those declared by this class.void
declareInterface
(String name) Add an interface to those declared by this class.void
declareInterface
(BCClass type) Add an interface to those declared by this class.declareMethod
(String name, Class returnType, Class[] paramTypes) Add a method to this class.declareMethod
(String name, String returnType, String[] paramTypes) Add a method to this class.declareMethod
(String name, BCClass returnType, BCClass[] paramTypes) Add a method to this class.declareMethod
(BCMethod method) Import the information in the given method as a new method of this class.int
Return the access flags for this class as a bit array of ACCESS_XXX constants fromConstants
.Return the class loader to use when loading related classes.Return the name of the class only, without package.Return the component type of this class, or null if not an array.Return the component type name of this class, or null if not an array.Return the component type of this class, or null if not an array.getDeclaredField
(String name) Return the declared field with the given name, or null if none.BCField[]
Return all the declared fields of this class, or an empty array if none.BCClass[]
Return the bytecode for the declared interfaces of this class, or an empty array if none.int[]
Return the list ofConstantPool
indexes of theClassEntry
s describing all the interfaces this class declares that it implements/extends.String[]
Return the names of the interfaces declared for this class, including package names, or an empty array if none.Class[]
Return theClass
objects for the declared interfaces of this class, or an empty array if none.getDeclaredMethod
(String name) Return the declared method with the given name, or null if none.getDeclaredMethod
(String name, Class[] paramTypes) Return the declared method with the given name and parameter types, or null if none.getDeclaredMethod
(String name, Class returnType, Class[] paramTypes) Return the declared method with the given name and signature, or null if none.getDeclaredMethod
(String name, String[] paramTypes) Return the declared method with the given name and parameter types, or null if none.getDeclaredMethod
(String name, String returnType, String[] paramTypes) Return the declared method with the given name and signature, or null if none.getDeclaredMethod
(String name, BCClass[] paramTypes) Return the declared method with the given name and parameter types, or null if none.getDeclaredMethod
(String name, BCClass returnType, BCClass[] paramTypes) Return the declared method with the given name and signature, or null if none.BCMethod[]
Return all methods declared by this class.BCMethod[]
getDeclaredMethods
(String name) Return all the declared methods with the given name, or an empty array if none.BCMethod[]
getDeclaredMethods
(String name, Class[] paramTypes) Return all declared methods with the given name and parameter types.BCMethod[]
getDeclaredMethods
(String name, String[] paramTypes) Return all declared methods with the given name and parameter types.BCMethod[]
getDeclaredMethods
(String name, BCClass[] paramTypes) Return all declared methods with the given name and parameter types.BCField[]
Return all the fields of this class, including those of all superclasses, or an empty array if none.BCField[]
Return all fields with the given name, including those of all superclasses, or an empty array if none.int
getIndex()
Return theConstantPool
index of theClassEntry
for this class.getInnerClasses
(boolean add) Return inner classes information for the class.BCClass[]
Return the bytecode of all unique interfaces implemented by this class, including those of all superclasses.String[]
Return the names of all unique interfaces implemented by this class, including those of all superclasses.Class[]
Return theClass
objects of all unique interfaces implemented by this class, including those of all superclasses.int
getMagic()
Return the magic number for this class; if this is a valid type, this should be equal toConstants.VALID_MAGIC
(the default value).int
Return the major version of the bytecode spec used for this class.BCMethod[]
Return the methods of this class, including those of all superclasses, or an empty array if none.BCMethod[]
getMethods
(String name) Return the methods with the given name, including those of all superclasses, or an empty array if none.BCMethod[]
getMethods
(String name, Class[] paramTypes) Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none.BCMethod[]
getMethods
(String name, String[] paramTypes) Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none.BCMethod[]
getMethods
(String name, BCClass[] paramTypes) Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none.int
Get the minor version of the bytecode spec used for this class.getName()
Return the name of this class, including package name.Return the package name only, without class, or null if none.getPool()
Return the constant pool of the current class.Return the project of the current class.getSourceFile
(boolean add) Return source file information for the class.Return the bytecode of the superclass of this class, or null for types without superclasses.int
Return theConstantPool
index of theClassEntry
for the superclass of this class.Return the name of the superclass for this class, including package name.Return theClass
object for the superclass of this class, if it is loadable.getType()
Return theClass
object for this class, if it is loadable.boolean
Manipulate the class access flags.boolean
Manipulate the class access flags.boolean
isArray()
Return true if this class is an array type.boolean
Convenience method to return deprecation information for the class.boolean
isEnum()
Manipulate the class access flags.boolean
isFinal()
Manipulate the class access flags.boolean
isInstanceOf
(Class type) Return true if this class or any of its superclasses implement/extend the given interface/class.boolean
isInstanceOf
(String name) Return true if this class or any of its superclasses implement/extend the given interface/class.boolean
isInstanceOf
(BCClass type) Return true if this class or any of its superclasses implement/extend the given interface/class.boolean
Manipulate the class access flags.boolean
Manipulate the class access flags.boolean
Return true if this class is a primitive type.boolean
isPublic()
Manipulate the class access flags.boolean
Manipulate the class access flags.boolean
isValid()
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.void
Manipulate the class access flags.void
Manipulate the class access flags.void
moveDeclaredField
(int fromIdx, int toIdx) Rearrange declared field order.void
moveDeclaredInterface
(int fromIdx, int toIdx) Rearrange declared interface order.void
moveDeclaredMethod
(int fromIdx, int toIdx) Rearrange method order.boolean
removeDeclaredField
(String name) Remove a field from this class.boolean
removeDeclaredField
(BCField field) Remove a field from this class.boolean
removeDeclaredInterface
(Class type) Remove an interface declared by this class.boolean
Remove an interface declared by this class.boolean
Remove an interface declared by this class.boolean
removeDeclaredMethod
(String name) Remove a method from this class.boolean
removeDeclaredMethod
(String name, Class[] paramTypes) Removes a method from this class.boolean
removeDeclaredMethod
(String name, String[] paramTypes) Removes a method from this class.boolean
removeDeclaredMethod
(String name, BCClass[] paramTypes) Removes a method from this class.boolean
removeDeclaredMethod
(BCMethod method) Removes a method from this class.boolean
Remove the inner classes attribute for the class.boolean
Remove the source file attribute for the class.void
setAbstract
(boolean on) Manipulate the class access flags.void
setAccessFlags
(int access) Set the access flags for this class as a bit array of ACCESS_XXX constants fromConstants
.void
setAnnotation
(boolean on) Manipulate the class access flags.void
setDeclaredFields
(BCField[] fields) Set the fields for this class; this method is useful for importing all fields from another class.void
setDeclaredInterfaceIndexes
(int[] interfaceIndexes) Set the list ofConstantPool
indexes of theClassEntry
s describing all the interfaces this class declares it implements/extends; set to null or an empty array if none.void
setDeclaredInterfaces
(Class[] interfaces) Set the interfaces declared implemented/extended by this class; set to null or an empty array if none.void
setDeclaredInterfaces
(String[] interfaces) Set the interfaces declared implemented/extended by this class; set to null or an empty array if none.void
setDeclaredInterfaces
(BCClass[] interfaces) Set the interfaces declared implemented/extended by this class; set to null or an empty array if none.void
setDeclaredMethods
(BCMethod[] methods) Set the methods for this class; this method is useful for importing all methods from another class.void
setDeprecated
(boolean on) Convenience method to set whether this class should be considered deprecated.void
setEnum
(boolean on) Manipulate the class access flags.void
setFinal
(boolean on) Manipulate the class access flags.void
setIndex
(int index) Set theConstantPool
index of theClassEntry
for this class.void
setInterface
(boolean on) Manipulate the class access flags.void
setMagic
(int magic) Set the magic number for this class; if this is a valid type, this should be equal toConstants.VALID_MAGIC
(the default value).void
setMajorVersion
(int majorVersion) Set the major version of the bytecode spec used for this class.void
setMinorVersion
(int minorVersion) Set the minor version of the bytecode spec used for this class.void
Set the name of this class, including package name.void
setSuperclass
(Class type) Set the superclass of this class.void
setSuperclass
(String name) Set the superclass of this class.void
setSuperclass
(BCClass type) Set the superclass of this class.void
setSuperclassIndex
(int index) Set theConstantPool
index of theClassEntry
for the superclass of this class.void
setSynthetic
(boolean on) Manipulate the class access flags.byte[]
Return the bytecode of this class as a byte array, possibly for use in a customClassLoader
.void
write()
Write the class bytecode to the .class file in the proper directory of the CLASSPATH.void
Write the class bytecode to the specified file.void
write
(OutputStream outstream) Write the class bytecode to the specified stream.Methods inherited from class serp.bytecode.Annotated
getDeclaredAnnotations, getDeclaredRuntimeAnnotations, removeDeclaredAnnotations, removeDeclaredRuntimeAnnotations
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, removeAttribute, removeAttribute, setAttributes
-
Method Details
-
write
Write the class bytecode to the .class file in the proper directory of the CLASSPATH. The file must exist already, so this method only works on existing classes.- Throws:
IOException
-
write
Write the class bytecode to the specified file.- Throws:
IOException
-
write
Write the class bytecode to the specified stream.- Throws:
IOException
-
toByteArray
public byte[] toByteArray()Return the bytecode of this class as a byte array, possibly for use in a customClassLoader
. -
getMagic
public int getMagic()Return the magic number for this class; if this is a valid type, this should be equal toConstants.VALID_MAGIC
(the default value). -
setMagic
public void setMagic(int magic) Set the magic number for this class; if this is a valid type, this should be equal toConstants.VALID_MAGIC
(the default value). -
getMajorVersion
public int getMajorVersion()Return the major version of the bytecode spec used for this class. JVMs are only required to operate with versions that they understand; leaving the default value ofConstants.MAJOR_VERSION
is safe. -
setMajorVersion
public void setMajorVersion(int majorVersion) Set the major version of the bytecode spec used for this class. JVMs are only required to operate with versions that they understand; leaving the default value ofConstants.MAJOR_VERSION
is safe. -
getMinorVersion
public int getMinorVersion()Get the minor version of the bytecode spec used for this class. JVMs are only required to operate with versions that they understand; leaving the default value ofConstants.MINOR_VERSION
is safe. -
setMinorVersion
public void setMinorVersion(int minorVersion) Set the minor version of the bytecode spec used for this class. JVMs are only required to operate with versions that they understand; leaving the default value ofConstants.MINOR_VERSION
is safe. -
getAccessFlags
public int getAccessFlags()Return the access flags for this class as a bit array of ACCESS_XXX constants fromConstants
. This can be used to transfer access flags between classes without getting/setting each possible flag. -
setAccessFlags
public void setAccessFlags(int access) Set the access flags for this class as a bit array of ACCESS_XXX constants fromConstants
. This can be used to transfer access flags between classes without getting/setting each possible flag. -
isPublic
public boolean isPublic()Manipulate the class access flags. -
makePublic
public void makePublic()Manipulate the class access flags. -
isPackage
public boolean isPackage()Manipulate the class access flags. -
makePackage
public void makePackage()Manipulate the class access flags. -
isFinal
public boolean isFinal()Manipulate the class access flags. -
setFinal
public void setFinal(boolean on) Manipulate the class access flags. -
isInterface
public boolean isInterface()Manipulate the class access flags. -
setInterface
public void setInterface(boolean on) Manipulate the class access flags. -
isAbstract
public boolean isAbstract()Manipulate the class access flags. -
setAbstract
public void setAbstract(boolean on) Manipulate the class access flags. -
isSynthetic
public boolean isSynthetic()Manipulate the class access flags. -
setSynthetic
public void setSynthetic(boolean on) Manipulate the class access flags. -
isAnnotation
public boolean isAnnotation()Manipulate the class access flags. -
setAnnotation
public void setAnnotation(boolean on) Manipulate the class access flags. Setting to true also makes this an interface. -
isEnum
public boolean isEnum()Manipulate the class access flags. -
setEnum
public void setEnum(boolean on) Manipulate the class access flags. -
isPrimitive
public boolean isPrimitive()Return true if this class is a primitive type. -
isArray
public boolean isArray()Return true if this class is an array type. -
getIndex
public int getIndex()Return theConstantPool
index of theClassEntry
for this class. Returns 0 if the class does not have a constant pool (such as a primitive or array). -
setIndex
public void setIndex(int index) Set theConstantPool
index of theClassEntry
for this class. Unlike most other low-level methods, the index will be checked against the pool immediately; classes must have a valid name at all times. -
getName
Return the name of this class, including package name. The name will be in a form suitable for aClass.forName(java.lang.String)
call. -
getClassName
Return the name of the class only, without package. -
getPackageName
Return the package name only, without class, or null if none. -
setName
Set the name of this class, including package name. -
getType
Return theClass
object for this class, if it is loadable. -
getComponentName
Return the component type name of this class, or null if not an array. The name will be in a form suitable for aClass.forName(java.lang.String)
call. -
getComponentType
Return the component type of this class, or null if not an array. -
getComponentBC
Return the component type of this class, or null if not an array. -
getSuperclassIndex
public int getSuperclassIndex()Return theConstantPool
index of theClassEntry
for the superclass of this class. Returns -1 if the class does not have a constant pool (such as a primitive or array). -
setSuperclassIndex
public void setSuperclassIndex(int index) Set theConstantPool
index of theClassEntry
for the superclass of this class. -
getSuperclassName
Return the name of the superclass for this class, including package name. The name will be in a form suitable for aClass.forName(java.lang.String)
call, or null for types without superclasses. -
getSuperclassType
Return theClass
object for the superclass of this class, if it is loadable. Returns null for types without superclasses. -
getSuperclassBC
Return the bytecode of the superclass of this class, or null for types without superclasses. -
setSuperclass
Set the superclass of this class. -
setSuperclass
Set the superclass of this class. -
setSuperclass
Set the superclass of this class. -
getDeclaredInterfaceIndexes
public int[] getDeclaredInterfaceIndexes()Return the list ofConstantPool
indexes of theClassEntry
s describing all the interfaces this class declares that it implements/extends.- Returns:
- the implmented interfaces, or an empty array if none
-
setDeclaredInterfaceIndexes
public void setDeclaredInterfaceIndexes(int[] interfaceIndexes) Set the list ofConstantPool
indexes of theClassEntry
s describing all the interfaces this class declares it implements/extends; set to null or an empty array if none. -
getDeclaredInterfaceNames
Return the names of the interfaces declared for this class, including package names, or an empty array if none. The names will be in a form suitable for aClass.forName(java.lang.String)
call. -
getDeclaredInterfaceTypes
Return theClass
objects for the declared interfaces of this class, or an empty array if none. -
getDeclaredInterfaceBCs
Return the bytecode for the declared interfaces of this class, or an empty array if none. -
setDeclaredInterfaces
Set the interfaces declared implemented/extended by this class; set to null or an empty array if none. -
setDeclaredInterfaces
Set the interfaces declared implemented/extended by this class; set to null or an empty array if none. -
setDeclaredInterfaces
Set the interfaces declared implemented/extended by this class; set to null or an empty array if none. -
getInterfaceNames
Return the names of all unique interfaces implemented by this class, including those of all superclasses. The names will be returned in a form suitable for aClass.forName(java.lang.String)
call. This method does not recurse into interfaces-of-interfaces. -
getInterfaceTypes
Return theClass
objects of all unique interfaces implemented by this class, including those of all superclasses. This method does not recurse into interfaces-of-interfaces. -
getInterfaceBCs
Return the bytecode of all unique interfaces implemented by this class, including those of all superclasses. This method does not recurse into interfaces-of-interfaces. -
clearDeclaredInterfaces
public void clearDeclaredInterfaces()Clear this class of all interface declarations. -
removeDeclaredInterface
Remove an interface declared by this class.- Returns:
- true if the class had the interface, false otherwise
-
removeDeclaredInterface
Remove an interface declared by this class.- Returns:
- true if the class had the interface, false otherwise
-
removeDeclaredInterface
Remove an interface declared by this class.- Returns:
- true if the class had the interface, false otherwise
-
moveDeclaredInterface
public void moveDeclaredInterface(int fromIdx, int toIdx) Rearrange declared interface order. -
declareInterface
Add an interface to those declared by this class. -
declareInterface
Add an interface to those declared by this class. -
declareInterface
Add an interface to those declared by this class. -
isInstanceOf
Return true if this class or any of its superclasses implement/extend the given interface/class. This method does not recurse into interfaces-of-interfaces. -
isInstanceOf
Return true if this class or any of its superclasses implement/extend the given interface/class. This method does not recurse into interfaces-of-interfaces. -
isInstanceOf
Return true if this class or any of its superclasses implement/extend the given interface/class. This method does not recurse into interfaces-of-interfaces. -
getDeclaredFields
Return all the declared fields of this class, or an empty array if none. -
getDeclaredField
Return the declared field with the given name, or null if none. -
getFields
Return all the fields of this class, including those of all superclasses, or an empty array if none. -
getFields
Return all fields with the given name, including those of all superclasses, or an empty array if none. -
setDeclaredFields
Set the fields for this class; this method is useful for importing all fields from another class. Set to null or empty array if none. -
declareField
Import the information from given field as a new field in this class.- Returns:
- the added field
-
declareField
Add a field to this class.- Returns:
- the added field
-
declareField
Add a field to this class.- Returns:
- the added field
-
declareField
Add a field to this class.- Returns:
- the added field
-
clearDeclaredFields
public void clearDeclaredFields()Clear all fields from this class. -
removeDeclaredField
Remove a field from this class. After this method, the removed field will be invalid, and the result of any operations on it is undefined.- Returns:
- true if this class contained the field, false otherwise
-
removeDeclaredField
Remove a field from this class. After this method, the removed field will be invalid, and the result of any operations on it is undefined.- Returns:
- true if this class contained the field, false otherwise
-
moveDeclaredField
public void moveDeclaredField(int fromIdx, int toIdx) Rearrange declared field order. -
getDeclaredMethods
Return all methods declared by this class. Constructors and static initializers are included. -
getDeclaredMethod
Return the declared method with the given name, or null if none. If multiple methods are declared with the given name, which is returned is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethods
Return all the declared methods with the given name, or an empty array if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and parameter types, or null if none. If multiple methods are declared with the given name and parameters, which is returned is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and parameter types, or null if none. If multiple methods are declared with the given name and parameters, which is returned is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and parameter types, or null if none. If multiple methods are declared with the given name and parameters, which is returned is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethods
Return all declared methods with the given name and parameter types. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethods
Return all declared methods with the given name and parameter types. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethods
Return all declared methods with the given name and parameter types. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and signature, or null if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and signature, or null if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getDeclaredMethod
Return the declared method with the given name and signature, or null if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getMethods
Return the methods of this class, including those of all superclasses, or an empty array if none. The base version of methods that are overridden will be included, as will all constructors and static initializers. The methods will be ordered from those in the most-specific type up to those inObject
. -
getMethods
Return the methods with the given name, including those of all superclasses, or an empty array if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getMethods
Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getMethods
Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
getMethods
Return the methods with the given name and parameter types, including those of all superclasses, or an empty array if none. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
. -
setDeclaredMethods
Set the methods for this class; this method is useful for importing all methods from another class. Set to null or empty array if none. -
declareMethod
Import the information in the given method as a new method of this class.- Returns:
- the added method
-
declareMethod
Add a method to this class. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- the added method
-
declareMethod
Add a method to this class. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- the added method
-
declareMethod
Add a method to this class. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- the added method
-
clearDeclaredMethods
public void clearDeclaredMethods()Clear all declared methods from this class. -
removeDeclaredMethod
Remove a method from this class. After this method, the removed method will be invalid, and the result of any operations on it is undefined. If multiple methods match the given name, which is removed is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- true if this class contained the method, false otherwise
-
removeDeclaredMethod
Removes a method from this class. After this method, the removed method will be invalid, and the result of any operations on it is undefined.- Returns:
- true if this class contained the method, false otherwise
-
removeDeclaredMethod
Removes a method from this class. After this method, the removed method will be invalid, and the result of any operations on it is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- true if this class contained the method, false otherwise
-
removeDeclaredMethod
Removes a method from this class. After this method, the removed method will be invalid, and the result of any operations on it is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- true if this class contained the method, false otherwise
-
removeDeclaredMethod
Removes a method from this class. After this method, the removed method will be invalid, and the result of any operations on it is undefined. Note that in bytecode, constructors are named<init>
and static initializers are named<clinit>
.- Returns:
- true if this class contained the method, false otherwise
-
moveDeclaredMethod
public void moveDeclaredMethod(int fromIdx, int toIdx) Rearrange method order. -
addDefaultConstructor
Convenience method to add a default constructor to this class. If a default constructor already exists, this method will return it without modification. This method can only be called if the superclass has been set.- Returns:
- the default constructor
-
getSourceFile
Return source file information for the class. Acts internally through theAttributes
interface.- Parameters:
add
- if true, a new source file attribute will be added if not already present- Returns:
- the source file information, or null if none and the
add
param is set to false
-
removeSourceFile
public boolean removeSourceFile()Remove the source file attribute for the class. Acts internally through theAttributes
interface.- Returns:
- true if there was a file to remove
-
getInnerClasses
Return inner classes information for the class. Acts internally through theAttributes
interface.- Parameters:
add
- if true, a new inner classes attribute will be added if not already present- Returns:
- the inner classes information, or null if none and the
add
param is set to false
-
removeInnerClasses
public boolean removeInnerClasses()Remove the inner classes attribute for the class. Acts internally through theAttributes
interface.- Returns:
- true if there was an attribute to remove
-
isDeprecated
public boolean isDeprecated()Convenience method to return deprecation information for the class. Acts internally through theAttributes
interface. -
setDeprecated
public void setDeprecated(boolean on) Convenience method to set whether this class should be considered deprecated. Acts internally through theAttributes
interface. -
acceptVisit
Description copied from interface:VisitAcceptor
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.- Specified by:
acceptVisit
in interfaceVisitAcceptor
-
getProject
Description copied from interface:BCEntity
Return the project of the current class.- Specified by:
getProject
in interfaceBCEntity
-
getPool
Description copied from interface:BCEntity
Return the constant pool of the current class. -
getClassLoader
Description copied from interface:BCEntity
Return the class loader to use when loading related classes.- Specified by:
getClassLoader
in interfaceBCEntity
-
isValid
public boolean isValid()Description copied from interface:BCEntity
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
-