Package org.apache.bcel.generic
Class FieldGenOrMethodGen
- java.lang.Object
-
- org.apache.bcel.classfile.AccessFlags
-
- org.apache.bcel.generic.FieldGenOrMethodGen
-
- All Implemented Interfaces:
java.lang.Cloneable,NamedAndTyped
public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAndTyped, java.lang.Cloneable
Super class for FieldGen and MethodGen objects, since they have some methods in common!
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AnnotationEntryGen>annotationListprivate java.util.List<Attribute>attributeListprotected ConstantPoolGencpDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected java.lang.StringnameDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected TypetypeDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter-
Fields inherited from class org.apache.bcel.classfile.AccessFlags
access_flags
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFieldGenOrMethodGen()Constructs a FieldGenOrMethodGen.protectedFieldGenOrMethodGen(int accessFlags)Constructs a FieldGenOrMethodGen.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddAll(Attribute[] attributes)Adds all attributes from an array.voidaddAnnotationEntry(AnnotationEntryGen ag)Adds an annotation entry.voidaddAttribute(Attribute a)Add an attribute to this method.java.lang.Objectclone()AnnotationEntryGen[]getAnnotationEntries()Gets all annotation entries.Attribute[]getAttributes()Gets all attributes of this method or field.ConstantPoolGengetConstantPool()Gets the constant pool.java.lang.StringgetName()Gets the name.abstract java.lang.StringgetSignature()Gets the signature of method or field.TypegetType()Gets the type.voidremoveAnnotationEntries()Removes all annotation entries.voidremoveAnnotationEntry(AnnotationEntryGen ag)Removes an annotation entry.voidremoveAttribute(Attribute a)Removes an attribute.voidremoveAttributes()Removes all attributes.voidsetConstantPool(ConstantPoolGen cp)Sets the constant pool.voidsetName(java.lang.String name)Sets the name.voidsetType(Type type)Sets the type.-
Methods inherited from class org.apache.bcel.classfile.AccessFlags
getAccessFlags, getModifiers, isAbstract, isAbstract, isAnnotation, isAnnotation, isEnum, isEnum, isFinal, isFinal, isInterface, isInterface, isNative, isNative, isPrivate, isPrivate, isProtected, isProtected, isPublic, isPublic, isStatic, isStatic, isStrictfp, isStrictfp, isSynchronized, isSynchronized, isSynthetic, isSynthetic, isTransient, isTransient, isVarArgs, isVarArgs, isVolatile, isVolatile, setAccessFlags, setModifiers
-
-
-
-
Field Detail
-
name
@Deprecated protected java.lang.String name
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
type
@Deprecated protected Type type
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
cp
@Deprecated protected ConstantPoolGen cp
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
attributeList
private final java.util.List<Attribute> attributeList
-
annotationList
private final java.util.List<AnnotationEntryGen> annotationList
-
-
Method Detail
-
addAll
protected void addAll(Attribute[] attributes)
Adds all attributes from an array.- Parameters:
attributes- the attributes to add.
-
addAnnotationEntry
public void addAnnotationEntry(AnnotationEntryGen ag)
Adds an annotation entry.- Parameters:
ag- the annotation entry.- Since:
- 6.0
-
addAttribute
public void addAttribute(Attribute a)
Add an attribute to this method. Currently, the JVM knows about the 'Code', 'ConstantValue', 'Synthetic' and 'Exceptions' attributes. Other attributes will be ignored by the JVM but do no harm.- Parameters:
a- attribute to be added.
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
getAnnotationEntries
public AnnotationEntryGen[] getAnnotationEntries()
Gets all annotation entries.- Returns:
- all annotation entries.
-
getAttributes
public Attribute[] getAttributes()
Gets all attributes of this method or field.- Returns:
- all attributes of this method.
-
getConstantPool
public ConstantPoolGen getConstantPool()
Gets the constant pool.- Returns:
- the constant pool.
-
getName
public java.lang.String getName()
Description copied from interface:NamedAndTypedGets the name.- Specified by:
getNamein interfaceNamedAndTyped- Returns:
- name of method/field.
-
getSignature
public abstract java.lang.String getSignature()
Gets the signature of method or field.- Returns:
- signature of method/field.
-
getType
public Type getType()
Description copied from interface:NamedAndTypedGets the type.- Specified by:
getTypein interfaceNamedAndTyped- Returns:
- the type.
-
removeAnnotationEntries
public void removeAnnotationEntries()
Removes all annotation entries.- Since:
- 6.0
-
removeAnnotationEntry
public void removeAnnotationEntry(AnnotationEntryGen ag)
Removes an annotation entry.- Parameters:
ag- the annotation entry to remove.- Since:
- 6.0
-
removeAttribute
public void removeAttribute(Attribute a)
Removes an attribute.- Parameters:
a- the attribute to remove.
-
removeAttributes
public void removeAttributes()
Removes all attributes.
-
setConstantPool
public void setConstantPool(ConstantPoolGen cp)
Sets the constant pool.- Parameters:
cp- the constant pool.
-
setName
public void setName(java.lang.String name)
Description copied from interface:NamedAndTypedSets the name.- Specified by:
setNamein interfaceNamedAndTyped- Parameters:
name- the name.
-
setType
public void setType(Type type)
Description copied from interface:NamedAndTypedSets the type.- Specified by:
setTypein interfaceNamedAndTyped- Parameters:
type- the type.
-
-