Examples of FieldNode


Examples of org.codehaus.groovy.ast.FieldNode

            addLogField(classNode, logName);
        }
    }

    public static void addLogField(ClassNode classNode, String logName) {
        FieldNode logVariable = new FieldNode(LOG_PROPERTY,
                                              Modifier.STATIC | Modifier.PRIVATE,
                                              new ClassNode(Log.class),
                                              classNode,
                                              new MethodCallExpression(new ClassExpression(new ClassNode(LogFactory.class)), "getLog", new ArgumentListExpression(new ConstantExpression(logName))));
View Full Code Here

Examples of org.codehaus.groovy.ast.FieldNode

        addGetConstraintsMethod(classNode, defaultNullable);
        addValidateMethod(classNode);
    }

    protected void addConstraintsField(final ClassNode classNode) {
        FieldNode field = classNode.getField(CONSTRAINED_PROPERTIES_PROPERTY_NAME);
        if (field == null || !field.getDeclaringClass().equals(classNode)) {
            classNode.addField(CONSTRAINED_PROPERTIES_PROPERTY_NAME,
                Modifier.STATIC | Modifier.PRIVATE, new ClassNode(Map.class),
                new ConstantExpression(null));
        }
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.FieldNode

        AnnotatedNode parent = (AnnotatedNode) nodes[1];
        AnnotationNode annotationNode = (AnnotationNode) nodes[0];

        if (parent instanceof FieldNode) {
            Expression value = annotationNode.getMember("value");
            FieldNode fieldNode = (FieldNode) parent;
            final ClassNode type = fieldNode.getType();
            final ClassNode owner = fieldNode.getOwner();
            ClassNode supportedType = owner;
            if (value instanceof ClassExpression) {
                supportedType = value.getType();
            }

            GrailsASTUtils.addDelegateInstanceMethods(supportedType, owner, type, new VariableExpression(fieldNode.getName()), resolveGenericsPlaceHolders(supportedType), isNoNullCheck(), isUseCompileStatic());
        }
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.FieldNode

                }
            }
        }
        Collection<MethodNode> exceptionHandlerMethods = getExceptionHandlerMethods(classNode, source);

        final FieldNode exceptionHandlerMetaDataField = classNode.getField(EXCEPTION_HANDLER_META_DATA_FIELD_NAME);
        if(exceptionHandlerMetaDataField == null || !exceptionHandlerMetaDataField.getDeclaringClass().equals(classNode)) {
            final ListExpression listOfExceptionHandlerMetaData = new ListExpression();
            for(final MethodNode exceptionHandlerMethod : exceptionHandlerMethods) {
                final Parameter[] parameters = exceptionHandlerMethod.getParameters();
                final Parameter firstParameter = parameters[0];
                final ClassNode firstParameterTypeClassNode = firstParameter.getType();
View Full Code Here

Examples of org.codehaus.groovy.ast.FieldNode

        GrailsASTUtils.addEnhancedAnnotation(controllerClass, DefaultGrailsControllerClass.ALLOWED_HTTP_METHODS_PROPERTY);
        final BlockStatement checkAllowedMethodsBlock = new BlockStatement();
       
        final PropertyExpression requestPropertyExpression = new PropertyExpression(new VariableExpression("this"), "request");
       
        final FieldNode allowedMethodsField = controllerClass.getField(DefaultGrailsControllerClass.ALLOWED_HTTP_METHODS_PROPERTY);
       
        if(allowedMethodsField != null) {
            final Expression initialAllowedMethodsExpression = allowedMethodsField.getInitialExpression();
            if(initialAllowedMethodsExpression instanceof MapExpression) {
                final List<String> allowedMethodNames = new ArrayList<String>();
                final MapExpression allowedMethodsMapExpression = (MapExpression) initialAllowedMethodsExpression;
                final List<MapEntryExpression> allowedMethodsMapEntryExpressions = allowedMethodsMapExpression.getMapEntryExpressions();
                for(MapEntryExpression allowedMethodsMapEntryExpression : allowedMethodsMapEntryExpressions) {
View Full Code Here

Examples of org.objectweb.asm.tree.FieldNode

        isPresent = true;
        break;
      }
    }
    if (!isPresent) {
      cn.fields.add(new FieldNode(fieldAccess, fieldName, fieldDesc,
          null, null));
    }
    super.transform(cn);
  }
View Full Code Here

Examples of org.objectweb.asm.tree.FieldNode

        insns.insert(il);

        mn.maxStack += 4;
      }
      int acc = ACC_PUBLIC + ACC_STATIC;
      cn.fields.add(new FieldNode(acc, "timer", "J", null, null));
    }
    super.transform(cn);
  }
View Full Code Here

Examples of org.objectweb.asm.tree.FieldNode

    cn.access = ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE;
    cn.name = "pkg/Comparable";
    cn.superName = "java/lang/Object";
    cn.interfaces.add("pkg/Mesurable");
    cn.sourceFile = "Comparable.java";
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "LESS", "I", null, new Integer(-1)));
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "EQUAL", "I", null, new Integer(0)));
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "GREATER", "I", null, new Integer(1)));
    cn.methods.add(new MethodNode(ACC_PUBLIC + ACC_ABSTRACT,
        "compareTo", "(Ljava/lang/Object;)I", null, null));
    ClassWriter cw = new ClassWriter(0);
    cn.accept(cw);
View Full Code Here

Examples of org.objectweb.asm.tree.FieldNode

  }

  public void transform(ClassNode cn) {
    Iterator i = cn.fields.iterator();
    while (i.hasNext()) {
      FieldNode fn = (FieldNode) i.next();
      if (fieldName.equals(fn.name)) {
        i.remove();
      }
    }
    super.transform(cn);
View Full Code Here

Examples of org.objectweb.asm.tree.FieldNode

    cn.version = V1_6;
    cn.access = ACC_PUBLIC;
    cn.name = "pkg/Bean";
    cn.superName = "java/lang/Object";
    cn.sourceDebug = "Bean.java";
    cn.fields.add(new FieldNode(ACC_PRIVATE, "f", "I", null, null));
    {
      MethodNode mn = new MethodNode(ACC_PUBLIC, "<init>", "()V", null,
          null);
      cn.methods.add(mn);
      InsnList il = mn.instructions;
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.