All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kendal.api.AstNodeBuilder Maven / Gradle / Ivy

The newest version!
package kendal.api;

import java.util.List;

import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCBinary;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCCatch;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCExpressionStatement;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCIdent;
import com.sun.tools.javac.tree.JCTree.JCLiteral;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
import com.sun.tools.javac.tree.JCTree.JCNewClass;
import com.sun.tools.javac.tree.JCTree.JCReturn;
import com.sun.tools.javac.tree.JCTree.JCThrow;
import com.sun.tools.javac.tree.JCTree.JCTry;
import com.sun.tools.javac.tree.JCTree.JCTypeUnion;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;

import kendal.api.builders.BlockBuilder;
import kendal.api.builders.FieldAccessBuilder;
import kendal.api.builders.IdentifierBuilder;
import kendal.api.builders.MethodDeclBuilder;
import kendal.api.builders.MethodInvocationBuilder;
import kendal.api.builders.NewClassBuilder;
import kendal.api.builders.TryBuilder;
import kendal.api.builders.VariableDeclBuilder;
import kendal.api.exceptions.ImproperNodeTypeException;
import kendal.model.Node;

public interface AstNodeBuilder {

    // - SPECIFIC BUILDERS ----------------------------------------------------------------------

    /**
     * Returns {@link Node} builder.
     */
    VariableDeclBuilder variableDecl();

    /**
     * Returns {@link Node} builder.
     */
    MethodDeclBuilder methodDecl();

    /**
     * Returns {@link Node} builder.
     */
    MethodInvocationBuilder methodInvocation();

    /**
     * Returns {@link Node} builder.
     */
    FieldAccessBuilder fieldAccess();

    /**
     * Returns {@link Node} builder.
     */
    BlockBuilder block();

    /**
     * Returns {@link Node} builder.
     */
    IdentifierBuilder identifier();

    /**
     * Returns {@link Node} builder.
     */
    TryBuilder tryBlock();

    /**
     * Returns {@link Node} builder.
     */
    NewClassBuilder newClass();



    // - INDIVIDUAL BUILD METHODS ----------------------------------------------------------------------

    /**
     * Constructs field accessor for more complex expressions (the ones using dots).
     * Returns either {@link Node} or {@link Node}.
     */
    Node getAccessor(String fullName);

     Node buildReturnStatement(Node expression);

    Node buildCatch(Node param, Node body);

     Node buildThrow(Node expression);

     Node buildTypeUnion(List> components);

    JCExpression buildType(Type type);

    JCBinary buildBinary(JCTree.Tag opcode, JCExpression lhs, JCExpression rhs);

    JCLiteral buildLiteral(String value);

    // ExpressionStatements:
     Node buildAssignmentStatement(Node lhs,
            Node rhs) throws ImproperNodeTypeException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy