package net.sourceforge.javautil.bytecode.api;
import net.sourceforge.javautil.bytecode.api.type.method.BytecodeContextMethod;
import net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation;
/**
* The base for most referenceables.
*
* @author elponderador
* @author $Author$
* @version $Id$
*/
public abstract class BytecodeReferenceableAbstract<C extends BytecodeContextMethod> implements IBytecodeReferenceable<C> {
protected final TypeDescriptor descriptor;
public BytecodeReferenceableAbstract(TypeDescriptor descriptor) {
this.descriptor = descriptor;
}
public TypeDescriptor getType() { return this.descriptor; }
public IBytecodeResolvable getType(C ctx) { return ctx.getResolutionPool().resolve(descriptor.getClassName()); }
public MethodInvocation createInvocation(C context, String name, IBytecodeReferenceable... parameters) {
return new MethodInvocation(this, this.getType(context).findMethod(context.getResolutionPool(), name, context.getTypes(parameters)), parameters);
}
}