FileDocCategorySizeDatePackage
FieldGenOrMethodGen.javaAPI DocJava SE 6 API5033Tue Jun 10 00:22:20 BST 2008com.sun.org.apache.bcel.internal.generic

FieldGenOrMethodGen

public abstract class FieldGenOrMethodGen extends AccessFlags implements Cloneable, NamedAndTyped
Super class for FieldGen and MethodGen objects, since they have some methods in common!
version
$Id: FieldGenOrMethodGen.java,v 1.1.2.1 2005/07/31 23:44:49 jeffsuttor Exp $
author
M. Dahm

Fields Summary
protected String
name
protected Type
type
protected ConstantPoolGen
cp
private ArrayList
attribute_vec
Constructors Summary
protected FieldGenOrMethodGen()


    
Methods Summary
public voidaddAttribute(com.sun.org.apache.bcel.internal.classfile.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.

param
a attribute to be added

 attribute_vec.add(a); 
public java.lang.Objectclone()

    try {
      return super.clone();
    } catch(CloneNotSupportedException e) {
      System.err.println(e);
      return null;
    }
  
public com.sun.org.apache.bcel.internal.classfile.Attribute[]getAttributes()

return
all attributes of this method.

    Attribute[] attributes = new Attribute[attribute_vec.size()];
    attribute_vec.toArray(attributes);
    return attributes;
  
public com.sun.org.apache.bcel.internal.generic.ConstantPoolGengetConstantPool()

 return cp; 
public java.lang.StringgetName()

return
name of method/field.

 return name; 
public abstract java.lang.StringgetSignature()

return
signature of method/field.

public com.sun.org.apache.bcel.internal.generic.TypegetType()

 return type; 
public voidremoveAttribute(com.sun.org.apache.bcel.internal.classfile.Attribute a)
Remove an attribute.

 attribute_vec.remove(a); 
public voidremoveAttributes()
Remove all attributes.

 attribute_vec.clear(); 
public voidsetConstantPool(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cp)

 this.cp = cp; 
public voidsetName(java.lang.String name)

 this.name = name; 
public voidsetType(com.sun.org.apache.bcel.internal.generic.Type type)

    if(type.getType() == Constants.T_ADDRESS)
      throw new IllegalArgumentException("Type can not be " + type);

    this.type = type;