Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.bcel.generic
Class FieldGenOrMethodGen  view FieldGenOrMethodGen download FieldGenOrMethodGen.java

java.lang.Object
  extended byorg.apache.bcel.classfile.AccessFlags
      extended byorg.apache.bcel.generic.FieldGenOrMethodGen
All Implemented Interfaces:
java.lang.Cloneable, NamedAndTyped, java.io.Serializable
Direct Known Subclasses:
FieldGen, MethodGen

public abstract class FieldGenOrMethodGen
extends org.apache.bcel.classfile.AccessFlags
implements NamedAndTyped, java.lang.Cloneable

Super class for FieldGen and MethodGen objects, since they have some methods in common!

Version:
$Id: FieldGenOrMethodGen.java 410087 2006-05-29 12:12:19Z tcurdt $

Field Summary
private  java.util.List attribute_vec
           
protected  ConstantPoolGen cp
           
protected  java.lang.String name
           
protected  Type type
           
 
Fields inherited from class org.apache.bcel.classfile.AccessFlags
access_flags
 
Constructor Summary
protected FieldGenOrMethodGen()
           
 
Method Summary
 void addAttribute(org.apache.bcel.classfile.Attribute a)
          Add an attribute to this method.
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 org.apache.bcel.classfile.Attribute[] getAttributes()
           
 ConstantPoolGen getConstantPool()
           
 java.lang.String getName()
           
abstract  java.lang.String getSignature()
           
 Type getType()
           
 void removeAttribute(org.apache.bcel.classfile.Attribute a)
          Remove an attribute.
 void removeAttributes()
          Remove all attributes.
 void setConstantPool(ConstantPoolGen cp)
           
 void setName(java.lang.String name)
           
 void setType(Type 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, isVolatile, isVolatile, setAccessFlags, setModifiers
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

type

protected Type type

cp

protected ConstantPoolGen cp

attribute_vec

private java.util.List attribute_vec
Constructor Detail

FieldGenOrMethodGen

protected FieldGenOrMethodGen()
Method Detail

setType

public void setType(Type type)
Specified by:
setType in interface NamedAndTyped

getType

public Type getType()
Specified by:
getType in interface NamedAndTyped

getName

public java.lang.String getName()
Specified by:
getName in interface NamedAndTyped

setName

public void setName(java.lang.String name)
Specified by:
setName in interface NamedAndTyped

getConstantPool

public ConstantPoolGen getConstantPool()

setConstantPool

public void setConstantPool(ConstantPoolGen cp)

addAttribute

public void addAttribute(org.apache.bcel.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.


removeAttribute

public void removeAttribute(org.apache.bcel.classfile.Attribute a)
Remove an attribute.


removeAttributes

public void removeAttributes()
Remove all attributes.


getAttributes

public org.apache.bcel.classfile.Attribute[] getAttributes()

getSignature

public abstract java.lang.String getSignature()

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }