Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

FieldGenOrMethodGen.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.classfile.*;
00004 import java.util.Vector;
00005 
00006 /**
00007  * Super class for FieldGen and MethodGen objects, since they have
00008  * some methods in common!
00009  *
00010  * @version $Id: FieldGenOrMethodGen.java,v 1.1.1.1 2002/01/24 03:41:39 pserver Exp $
00011  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00012  */
00013 public abstract class FieldGenOrMethodGen extends AccessFlags
00014   implements NamedAndTyped, Cloneable
00015 {
00016   protected String          name;
00017   protected Type            type;
00018   protected ConstantPoolGen cp;
00019   private   Vector          attribute_vec = new Vector();
00020 
00021   protected FieldGenOrMethodGen() {}  
00022   /**
00023    * Add an attribute to this method. Currently, the JVM knows about
00024    * the `Code', `ConstantValue', `Synthetic' and `Exceptions'
00025    * attributes. Other attributes will be ignored by the JVM but do no
00026    * harm.
00027    *
00028    * @param a attribute to be added
00029    */
00030   public void addAttribute(Attribute a) { attribute_vec.addElement(a); }  
00031   public Object clone() {
00032     try {
00033       return super.clone();
00034     } catch(CloneNotSupportedException e) {
00035       System.err.println(e);
00036       return null;
00037     }
00038   }  
00039   /**
00040    * @return all attributes of this method.
00041    */
00042   public Attribute[] getAttributes() {
00043     Attribute[] attributes = new Attribute[attribute_vec.size()];
00044     attribute_vec.copyInto(attributes);
00045     return attributes;
00046   }  
00047   public ConstantPoolGen getConstantPool()                   { return cp; }  
00048   /** @return name of method/field.
00049    */
00050   public String          getName()            { return name; }  
00051   /** @return signature of method/field.
00052    */
00053   public abstract String  getSignature();  
00054   public Type            getType()            { return type; }  
00055   /**
00056    * Remove an attribute.
00057    */
00058   public void removeAttribute(Attribute a) { attribute_vec.removeElement(a); }  
00059   public void            setConstantPool(ConstantPoolGen cp) { this.cp = cp; }  
00060   public void            setName(String name) { this.name = name; }  
00061   public void            setType(Type type)   { this.type = type; }  
00062 }

Generated at Thu Feb 7 06:45:38 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001