package net.sourceforge.javautil.bytecode.api.type;
import net.sourceforge.javautil.bytecode.BytecodeCompiler;
import net.sourceforge.javautil.bytecode.api.MethodDescriptor;
import net.sourceforge.javautil.bytecode.api.TypeMemberAccess;
import net.sourceforge.javautil.bytecode.api.TypeMemberAccess.Scope;
import net.sourceforge.javautil.bytecode.api.type.method.BytecodeMethodAbstract;
/**
* A class that is abstract.
*
* @author elponderador
* @author $Author$
* @version $Id$
*/
public class JavaClassAbstract<C extends BytecodeContextType> extends JavaClass<C> {
public JavaClassAbstract(BytecodeCompiler compiler, String name, Scope scope, boolean isStatic, boolean isFinal) {
super(compiler, name, new TypeMemberAccess(scope, true, isStatic, isFinal));
}
/**
* @param name The name of the method
* @param returnType The return type, or null if void
* @param parameterTypes The types of parameters the method accepts
* @return The abstract method
*/
public BytecodeMethodAbstract addMethod (String name, boolean varArgs, Scope scope, String returnType, String... parameterTypes) {
this.methods.add(new BytecodeMethodAbstract(this, name, new TypeMemberAccess(scope, true, false, false),
new MethodDescriptor(varArgs, returnType, parameterTypes)));
return (BytecodeMethodAbstract) this.methods.get(methods.size()-1);
}
public JavaClassAbstract cloneAs(String name, boolean isStatic, boolean isFinal) {
JavaClassAbstract jca = new JavaClassAbstract(compiler, name, access.getScope(), isStatic, isFinal);
this.internalClone(jca);
return jca;
}
}