Examples of MethodDescriptor


Examples of net.sourceforge.javautil.bytecode.api.MethodDescriptor

   * @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);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.MethodDescriptor

   * @param parameterTypes The types of parameters the method accepts
   * @return The abstract method
   */
  public BytecodeMethodAbstract addMethod (String name, boolean varArgs, String returnType, String... parameterTypes) {
    this.methods.add(new BytecodeMethodAbstract(this, name, new TypeMemberAccess(Scope.Public, true, false, false),
      new MethodDescriptor(varArgs, returnType, null, parameterTypes)));
    return (BytecodeMethodAbstract) this.methods.get(methods.size()-1);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.MethodDescriptor

    final BytecodeFieldDeclaration field = this.fields.get(fieldName);
    final boolean isStatic = field.getAccess().isStatic();
   
    BytecodeMethodConcrete getter = this.addMethod(getterName,
      new TypeMemberAccess(Scope.Public, false, isStatic, false),
      new MethodDescriptor(false, field.getType(), new TypeDescriptor[0])).setMethodBody(new BytecodeBlock() {
       
        @Override protected void writeInstructions(BytecodeContextMethod context) {
          context.returnValue(isStatic ? context.getStaticField(fieldName) : context.getThisField(fieldName));
        }
       
      });
   
    if (setterName != null) {
      this.addMethod(setterName,
        new TypeMemberAccess(Scope.Public, false, isStatic, false),
        new MethodDescriptor(false, TypeDescriptor.VOID, new TypeDescriptor[0], field.getType())).setMethodBody(new BytecodeBlock() {
         
          @Override protected void writeInstructions(BytecodeContextMethod context) {
            context.setArrayIndexValue(isStatic ? context.getStaticField(fieldName) : context.getThisField(fieldName), context.getDeclaredParameter(0));
          }
         
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.MethodDescriptor

* @version $Id$
*/
public class BytecodeConstructorBase extends BytecodeMethodConcrete implements IBytecodeConstructor {
 
  public BytecodeConstructorBase(AbstractType type, TypeMemberAccess access, boolean varArgs, TypeDescriptor... parameterTypes) {
    super(type, "<init>", access, new MethodDescriptor(varArgs, TypeDescriptor.VOID, null, parameterTypes));
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.MethodDescriptor

   
    context.getClassWriter().visitSource(null, null);
  }
 
  public void writeMethod(BytecodeContextTypeASM context, IBytecodeMethod method) {
    MethodDescriptor md = method.getDescriptor();
   
    String[] exceptions = new String[md.getExceptionTypes() == null ? 0 : md.getExceptionTypes().length];
    for (int i=0; i<exceptions.length; i++) {
      exceptions[i] = md.getExceptionTypes()[i].getName();
    }
   
    int access = getAccess(method);
    String desc = md.toDescriptorString();
   
    MethodVisitor mv = context.getClassWriter().visitMethod(access, method.getName(), desc, null, exceptions);
    for (IBytecodeAnnotation ba : method.getDeclaredAnnotations()) {
      this.declareAnnotation(context, ba, mv.visitAnnotation(ba.getType().getType().toDescriptorString(), true));
    }
View Full Code Here

Examples of org.codehaus.metaclass.model.MethodDescriptor

        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final Attribute[] attributes = new Attribute[]{attribute};
        final ParameterDescriptor param =
            new ParameterDescriptor("locator", ResourceLocator.class.getName());
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor descriptor =
            new MethodDescriptor("compose","", params, attributes, attributes );
        return new ClassDescriptor( classname,
                                    Attribute.EMPTY_SET,
                                    Attribute.EMPTY_SET,
                                    FieldDescriptor.EMPTY_SET,
                                    new MethodDescriptor[]{descriptor} );
View Full Code Here

Examples of org.codehaus.metaclass.model.MethodDescriptor

            new Attribute( "dna.configuration", parameters )
        };
        final ParameterDescriptor param =
            new ParameterDescriptor( "X", Configuration.class.getName() );
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor method =
            new MethodDescriptor( "configure", "", params, attributes, attributes );
        final ClassDescriptor descriptor =
            new ClassDescriptor( BasicComponent.class.getName(),
                                 Attribute.EMPTY_SET,
                                 Attribute.EMPTY_SET,
                                 FieldDescriptor.EMPTY_SET,
View Full Code Here

Examples of org.codehaus.metaclass.model.MethodDescriptor

            new Attribute( "dna.configuration", parameters )
        };
        final ParameterDescriptor param =
            new ParameterDescriptor( "X", Configuration.class.getName() );
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor method =
            new MethodDescriptor( "configure", "", params, attributes, attributes );
        final ClassDescriptor descriptor =
            new ClassDescriptor( BasicComponent.class.getName(),
                                 Attribute.EMPTY_SET,
                                 Attribute.EMPTY_SET,
                                 FieldDescriptor.EMPTY_SET,
View Full Code Here

Examples of org.qi4j.api.composite.MethodDescriptor

     */
    public final CompositeMethodDetailDescriptor getMethodDescriptor( Method aMethod )
    {
        for( CompositeMethodDetailDescriptor descriptor : methods )
        {
            MethodDescriptor methodDescriptor = descriptor.descriptor();
            Method method = methodDescriptor.method();
            if( method.equals( aMethod ) )
            {
                return descriptor;
            }
        }
View Full Code Here

Examples of org.quorum.symbols.MethodDescriptor

    @Override
    public CompilerLocation GetLocationAtLine(String staticKey, int line) {
        CompilerLocation location = new CompilerLocation();
        ClassDescriptor clazz = this.virtualMachine.getSymbolTable().getClassDescriptor(staticKey);
        if(clazz != null) {
            MethodDescriptor method = clazz.getMethodAtLine(line, 0);
            if(method != null) {
                location.setName(method.getName());
                Parameters parameters = method.getParameters();
                if(parameters != null) {
                    for(int i = 0; i < parameters.size(); i++) {
                        ParameterDescriptor param = parameters.get(i);
                        location.add(param.getName(), param.getType().getStaticKey());
                    }
View Full Code Here
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.