Package com.bacoder.parser.java.api

Examples of com.bacoder.parser.java.api.Resource


      if (resourcesContext != null) {
        tryStatement.setResources(transform(resourcesContext, ResourceContext.class,
            new Function<ResourceContext, Resource>() {
              @Override
              public Resource apply(ResourceContext context) {
                Resource resource = createNode(context, Resource.class);

                setModifiers(context, resource);

                ClassOrInterfaceTypeContext classOrInterfaceTypeContext =
                    getChild(context, ClassOrInterfaceTypeContext.class);
                if (classOrInterfaceTypeContext != null) {
                  resource.setType(
                      getAdapter(ClassOrInterfaceTypeAdapter.class).adapt(
                          classOrInterfaceTypeContext));
                }

                VariableDeclaratorIdContext variableDeclaratorIdContext =
                    getChild(context, VariableDeclaratorIdContext.class);
                if (variableDeclaratorIdContext != null) {
                  TerminalNode identifierNode =
                      getTerminalNode(variableDeclaratorIdContext, JavaParser.Identifier);
                  if (identifierNode != null) {
                    resource.setName(getAdapter(IdentifierAdapter.class).adapt(identifierNode));
                  }

                  resource.setDimensions(
                      getAdapter(ArrayDimensionsAdapter.class).adapt(variableDeclaratorIdContext));
                }

                ExpressionContext expressionContext = getChild(context, ExpressionContext.class);
                if (expressionContext != null) {
                  resource.setInitializer(
                      getAdapter(ExpressionAdapter.class).adapt(expressionContext));
                }

                return resource;
              }
View Full Code Here

TOP

Related Classes of com.bacoder.parser.java.api.Resource

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.