Tabnine Logo
ClassNode.getOrAddStaticConstructorNode
Code IndexAdd Tabnine to your IDE (free)

How to use
getOrAddStaticConstructorNode
method
in
org.codehaus.groovy.ast.ClassNode

Best Java code snippets using org.codehaus.groovy.ast.ClassNode.getOrAddStaticConstructorNode (Showing top 6 results out of 315)

origin: org.codehaus.groovy/groovy

public void positionStmtsAfterEnumInitStmts(List<Statement> staticFieldStatements) {
  MethodNode method = getOrAddStaticConstructorNode();
  Statement statement = method.getCode();
  if (statement instanceof BlockStatement) {
    BlockStatement block = (BlockStatement) statement;
    // add given statements for explicitly declared static fields just after enum-special fields
    // are found - the $VALUES binary expression marks the end of such fields.
    List<Statement> blockStatements = block.getStatements();
    ListIterator<Statement> litr = blockStatements.listIterator();
    while (litr.hasNext()) {
      Statement stmt = litr.next();
      if (stmt instanceof ExpressionStatement &&
          ((ExpressionStatement) stmt).getExpression() instanceof BinaryExpression) {
        BinaryExpression bExp = (BinaryExpression) ((ExpressionStatement) stmt).getExpression();
        if (bExp.getLeftExpression() instanceof FieldExpression) {
          FieldExpression fExp = (FieldExpression) bExp.getLeftExpression();
          if (fExp.getFieldName().equals("$VALUES")) {
            for (Statement tmpStmt : staticFieldStatements) {
              litr.add(tmpStmt);
            }
          }
        }
      }
    }
  }
}
origin: org.codehaus.groovy/groovy

public void addStaticInitializerStatements(List<Statement> staticStatements, boolean fieldInit) {
  MethodNode method = getOrAddStaticConstructorNode();
  BlockStatement block = null;
  Statement statement = method.getCode();
  if (statement == null) {
    block = new BlockStatement();
  }
  else if (statement instanceof BlockStatement) {
    block = (BlockStatement) statement;
  }
  else {
    block = new BlockStatement();
    block.addStatement(statement);
  }
  // while anything inside a static initializer block is appended
  // we don't want to append in the case we have a initialization
  // expression of a static field. In that case we want to add
  // before the other statements
  if (!fieldInit) {
    block.addStatements(staticStatements);
  } else {
    List<Statement> blockStatements = block.getStatements();
    staticStatements.addAll(blockStatements);
    blockStatements.clear();
    blockStatements.addAll(staticStatements);
  }
}
origin: org.codehaus.groovy/groovy-jdk14

public void positionStmtsAfterEnumInitStmts(List<Statement> staticFieldStatements) {
  MethodNode method = getOrAddStaticConstructorNode();
  Statement statement = method.getCode();
  if (statement instanceof BlockStatement) {
    BlockStatement block = (BlockStatement) statement;
    // add given statements for explicitly declared static fields just after enum-special fields
    // are found - the $VALUES binary expression marks the end of such fields.
    List<Statement> blockStatements = block.getStatements();
    ListIterator<Statement> litr = blockStatements.listIterator();
    while(litr.hasNext()) {
      Statement stmt = litr.next();
      if(stmt instanceof ExpressionStatement && 
          ((ExpressionStatement)stmt).getExpression() instanceof BinaryExpression) {
        BinaryExpression bExp = (BinaryExpression) ((ExpressionStatement)stmt).getExpression();
        if (bExp.getLeftExpression() instanceof FieldExpression) {
          FieldExpression fExp = (FieldExpression) bExp.getLeftExpression();
          if(fExp.getFieldName().equals("$VALUES")) {
            for(Statement tmpStmt : staticFieldStatements) {
              litr.add(tmpStmt);
            }
          }
        }
      }
    }
  }
}
/**
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public void positionStmtsAfterEnumInitStmts(List<Statement> staticFieldStatements) {
  MethodNode method = getOrAddStaticConstructorNode();
  Statement statement = method.getCode();
  if (statement instanceof BlockStatement) {
    BlockStatement block = (BlockStatement) statement;
    // add given statements for explicitly declared static fields just after enum-special fields
    // are found - the $VALUES binary expression marks the end of such fields.
    List<Statement> blockStatements = block.getStatements();
    ListIterator<Statement> litr = blockStatements.listIterator();
    while (litr.hasNext()) {
      Statement stmt = litr.next();
      if (stmt instanceof ExpressionStatement &&
          ((ExpressionStatement) stmt).getExpression() instanceof BinaryExpression) {
        BinaryExpression bExp = (BinaryExpression) ((ExpressionStatement) stmt).getExpression();
        if (bExp.getLeftExpression() instanceof FieldExpression) {
          FieldExpression fExp = (FieldExpression) bExp.getLeftExpression();
          if (fExp.getFieldName().equals("$VALUES")) {
            for (Statement tmpStmt : staticFieldStatements) {
              litr.add(tmpStmt);
            }
          }
        }
      }
    }
  }
}
origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public void addStaticInitializerStatements(List<Statement> staticStatements, boolean fieldInit) {
  MethodNode method = getOrAddStaticConstructorNode();
  BlockStatement block = null;
  Statement statement = method.getCode();
  if (statement == null) {
    block = new BlockStatement();
  }
  else if (statement instanceof BlockStatement) {
    block = (BlockStatement) statement;
  }
  else {
    block = new BlockStatement();
    block.addStatement(statement);
  }
  // while anything inside a static initializer block is appended
  // we don't want to append in the case we have a initialization
  // expression of a static field. In that case we want to add
  // before the other statements
  if (!fieldInit) {
    block.addStatements(staticStatements);
  } else {
    List<Statement> blockStatements = block.getStatements();
    staticStatements.addAll(blockStatements);
    blockStatements.clear();
    blockStatements.addAll(staticStatements);
  }
}
origin: org.codehaus.groovy/groovy-jdk14

public void addStaticInitializerStatements(List staticStatements, boolean fieldInit) {
  MethodNode method = getOrAddStaticConstructorNode();
  BlockStatement block = null;
  Statement statement = method.getCode();
  if (statement == null) {
    block = new BlockStatement();
  }
  else if (statement instanceof BlockStatement) {
    block = (BlockStatement) statement;
  }
  else {
    block = new BlockStatement();
    block.addStatement(statement);
  }
  // while anything inside a static initializer block is appended
  // we don't want to append in the case we have a initialization
  // expression of a static field. In that case we want to add
  // before the other statements
  if (!fieldInit) {
    block.addStatements(staticStatements);
  } else {
    List blockStatements = block.getStatements();
    staticStatements.addAll(blockStatements);
    blockStatements.clear();
    blockStatements.addAll(staticStatements);
  }
}
org.codehaus.groovy.astClassNodegetOrAddStaticConstructorNode

Popular methods of ClassNode

  • getName
  • getMethods
    This methods creates a list of all methods with this name of the current class and of all super clas
  • <init>
    Constructor used by makeArray() if no real class is available
  • getSuperClass
  • equals
  • addMethod
  • getAnnotations
  • addField
  • getFields
    Returns a list containing FieldNode objects for each field in the class represented by this ClassNod
  • getPlainNodeReference
  • getField
    Finds a field matching the given name in this class or a parent class.
  • getMethod
    Finds a method matching the given name and parameters in this class or any parent class.
  • getField,
  • getMethod,
  • isInterface,
  • getNameWithoutPackage,
  • isScript,
  • getDeclaredMethod,
  • getGenericsTypes,
  • getDeclaredConstructors,
  • getModifiers,
  • getTypeClass

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now