Package net.sourceforge.javautil.bytecode.api

Source Code of net.sourceforge.javautil.bytecode.api.BytecodeResolvableAbstract

package net.sourceforge.javautil.bytecode.api;

import net.sourceforge.javautil.bytecode.api.IBytecodeResolvable.ClassType;
import net.sourceforge.javautil.bytecode.api.type.method.BytecodeContextMethod;
import net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation;

/**
* The base for most resolvable types.
*
* @author elponderador
* @author $Author$
* @version $Id$
*/
public abstract class BytecodeResolvableAbstract implements IBytecodeResolvable {
 
  protected final ClassType type;
  protected final TypeDescriptor descriptor;

  public BytecodeResolvableAbstract(ClassType type, TypeDescriptor descriptor) {
    this.type = type;
    this.descriptor = descriptor;
  }

  @Override public IBytecodeResolvable getType(BytecodeContextMethod ctx) {
    return this;
  }

  @Override public MethodInvocation createInvocation(BytecodeContextMethod context, String name, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(this, this.findMethod(context.getResolutionPool(), name, context.getTypes(parameters)), parameters);
  }

  @Override public void load(BytecodeContextMethod context) {
    context.loadType(this);
  }
 
  public ClassType getClassType() { return this.type; }

  public TypeDescriptor getType() { return this.descriptor; }

  public int compareTo(IBytecodeResolvable o) {
    return descriptor.getName().compareTo(o.getType().getName());
  }

}
TOP

Related Classes of net.sourceforge.javautil.bytecode.api.BytecodeResolvableAbstract

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.