1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 57 import com.sun.org.apache.bcel.internal.classfile.*; 58 import java.util.ArrayList ; 59 60 67 public abstract class FieldGenOrMethodGen extends AccessFlags 68 implements NamedAndTyped, Cloneable 69 { 70 protected String name; 71 protected Type type; 72 protected ConstantPoolGen cp; 73 private ArrayList attribute_vec = new ArrayList (); 74 75 protected FieldGenOrMethodGen() {} 76 77 public void setType(Type type) { this.type = type; } 78 public Type getType() { return type; } 79 80 82 public String getName() { return name; } 83 public void setName(String name) { this.name = name; } 84 85 public ConstantPoolGen getConstantPool() { return cp; } 86 public void setConstantPool(ConstantPoolGen cp) { this.cp = cp; } 87 88 96 public void addAttribute(Attribute a) { attribute_vec.add(a); } 97 98 101 public void removeAttribute(Attribute a) { attribute_vec.remove(a); } 102 103 106 public void removeAttributes() { attribute_vec.clear(); } 107 108 111 public Attribute[] getAttributes() { 112 Attribute[] attributes = new Attribute[attribute_vec.size()]; 113 attribute_vec.toArray(attributes); 114 return attributes; 115 } 116 117 119 public abstract String getSignature(); 120 121 public Object clone() { 122 try { 123 return super.clone(); 124 } catch(CloneNotSupportedException e) { 125 System.err.println(e); 126 return null; 127 } 128 } 129 } 130 | Popular Tags |