Package japa.parser.ast.visitor

Examples of japa.parser.ast.visitor.VoidVisitorAdapter


    // make it tolerant of lowercase default
    line = line.replace("@default(", "@Default(");
    String cl = String.format(classTempForParams, line);
    try {
      CompilationUnit cu = parse(cl);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
        @Override
        public void visit(Parameter p, Object arg) {
          ret.add(p);
        }
      };
View Full Code Here


    final List<String> ret = new ArrayList<String>();
    if (line == null || line.trim().length() == 0)
      return ret;


    @SuppressWarnings("rawtypes")
    VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      @Override
      public void visit(MethodCallExpr n, Object arg) {
        List<Expression> args = n.getArgs();
        // api issue: args can be null in case of empty arg list
        if (args != null)
View Full Code Here

    String cl = String.format(classTempForArgs, line);
    final String finalLine = line;
    try {
      CompilationUnit cu = parse(cl);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
        boolean hasNamed = false;
        boolean hasUnNamed = false;

        @Override
        public void visit(MethodCallExpr n, Object arg) {
View Full Code Here

    if (string == null || string.trim().length() == 0)
      return false;

    final StringBuilder re = new StringBuilder();

    VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      @Override
      public void visit(MethodCallExpr n, Object arg) {
        if (string.equals(n.getName())) {
          re.append(1);
          return;
View Full Code Here

  }

  public static boolean hasMethod(CompilationUnit cu, final String string) {
    final StringBuilder sb = new StringBuilder();

    VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      @Override
      public void visit(MethodDeclaration n, Object arg) {
        if (n.getName().equals(string)) {
          sb.append(1);
          return;
View Full Code Here

      paramList = "";
    String formalParamList = addParamNamesPlaceHolder(paramList);

    final List<Parameter> params = parseParams(formalParamList);

    VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      @Override
      public void visit(MethodDeclaration n, Object arg) {
        if (n.getName().equals(name)) {
          int modifiers2 = n.getModifiers();
          if (modifiers2 == modis) {
View Full Code Here

  public static void isValidMethDecl(String line) {
    final String classTempForMeth = "class T {  %s{} }";
    String classString = String.format(classTempForMeth, line);
    try {
      CompilationUnit cu = parse(classString);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
      };
      cu.accept(visitor, null);
    } catch (ParseException e) {
      throw new RuntimeException(
          "the line does not seem to be a valid method declaration: "
View Full Code Here

 
  public static List<CodeNode> parseCode(String code) {
    try{
      final List<CodeNode> nodes = new LinkedList();
      CompilationUnit cu = parse(code);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
        int nested = 0;
        @Override
        public void visit(AnnotationDeclaration n, Object arg) {
         
          nodes.add(new CodeNode(nested++, n)); super.visit(n, arg); nested--;
View Full Code Here

    if (line == null || line.trim().length() == 0)
      return ret;
    String cl = String.format(classTempForParams, line);
    try {
      CompilationUnit cu = parse(cl);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
        @Override
        public void visit(Parameter p, Object arg) {
          ret.add(p);
        }
      };
View Full Code Here

      return ret;

    String cl = String.format(classTempForArgs, line);
    try {
      CompilationUnit cu = parse(cl);
      VoidVisitorAdapter visitor = new VoidVisitorAdapter() {
        @Override
        public void visit(MethodCallExpr n, Object arg) {
          List<Expression> args = n.getArgs();
          // api issue: args can be null in case of empty arg list
          if (args != null)
View Full Code Here

TOP

Related Classes of japa.parser.ast.visitor.VoidVisitorAdapter

Copyright © 2018 www.massapicom. 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.