/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache BCEL" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache BCEL", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
*/
/**
* Template class for building up a java class. May be initialized with an
* existing java class (file).
*
* @see JavaClass
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
/* Corresponds to the fields found in a JavaClass object.
*/
// ArrayLists instead of arrays to gather fields, methods, etc.
/** Convenience constructor to set up some important values initially.
*
* @param class_name fully qualified class name
* @param super_class_name fully qualified superclass name
* @param file_name source file name
* @param access_flags access qualifiers
* @param interfaces implemented interfaces
* @param cp constant pool to use
*/
this.class_name = class_name;
this.super_class_name = super_class_name;
this.access_flags = access_flags;
// Put everything needed by default into the constant pool and the vectors
if(interfaces != null)
addInterface(interfaces[i]);
}
/** Convenience constructor to set up some important values initially.
*
* @param class_name fully qualified class name
* @param super_class_name fully qualified superclass name
* @param file_name source file name
* @param access_flags access qualifiers
* @param interfaces implemented interfaces
*/
new ConstantPoolGen());
}
/**
* Initialize with existing class.
* @param clazz JavaClass object (e.g. read from file)
*/
addInterface(interfaces[i]);
addAttribute(attributes[i]);
}
/**
* @return the (finally) built up Java class object.
*/
int[] interfaces = getInterfaces();
// Must be last since the above calls may still add something to it
}
/**
* Add an interface to this class, i.e., this class has to implement it.
* @param name interface to implement (fully qualified class name)
*/
}
/**
* Remove an interface from this class.
* @param name interface to remove (fully qualified name)
*/
}
/**
* @return major version number of class file
*/
/** Set major version number of class file, default value is 45 (JDK 1.1)
* @param major major version number
*/
}
/** Set minor version number of class file, default value is 3 (JDK 1.1)
* @param minor minor version number
*/
}
/**
* @return minor version number of class file
*/
/**
* Add an attribute to this class.
* @param a attribute to add
*/
/**
* Add a method to this class.
* @param m method to add
*/
/**
* Convenience method.
*
* Add an empty constructor to this class that does nothing but calling super().
* @param access rights for constructor
*/
"<init>", "()V")));
}
/**
* Add a field to this class.
* @param f field to add
*/
/** @return field object with given name, or null
*/
return f;
}
return null;
}
/** @return method object with given name and signature, or null
*/
return m;
}
return null;
}
/**
* Remove an attribute from this class.
* @param a attribute to remove
*/
/**
* Remove a method from this class.
* @param m method to remove
*/
/** Replace given method with new one. If the old one does not exist
* add the new_ method to the class anyway.
*/
throw new ClassGenException("Replacement method must not be null");
if(i < 0)
else
}
/** Replace given field with new one. If the old one does not exist
* add the new_ field to the class anyway.
*/
throw new ClassGenException("Replacement method must not be null");
if(i < 0)
else
}
/**
* Remove a field to this class.
* @param f field to remove
*/
}
}
return methods;
}
method_vec.clear();
}
}
}
return interfaces;
}
public int[] getInterfaces() {
int[] interfaces = new int[size];
for(int i=0; i < size; i++)
return interfaces;
}
return fields;
}
return attributes;
}
cp = constant_pool;
}
this.class_name_index = class_name_index;
}
}
/** Add observer for this object.
*/
}
/** Remove observer for this object.
*/
}
/** Call notify() method on all observers. This method is not called
* automatically whenever the state has changed, but has to be
* called by the user after he has finished editing the object.
*/
public void update() {
}
try {
return super.clone();
} catch(CloneNotSupportedException e) {
return null;
}
}
}