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

kendal.api.impl.builders.MethodDeclBuilderImpl Maven / Gradle / Ivy

The newest version!
package kendal.api.impl.builders;

import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCModifiers;
import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Name;

import kendal.api.AstUtils;
import kendal.api.builders.MethodDeclBuilder;
import kendal.model.Node;
import kendal.model.TreeBuilder;

public class MethodDeclBuilderImpl extends AbstractBuilder implements MethodDeclBuilder {

    public MethodDeclBuilderImpl(AstUtils astUtils, TreeMaker treeMaker) {
        super(astUtils, treeMaker);
    }

    @Override
    public Node build(JCModifiers modifiers, String name, JCExpression resType,
            List typarams, List params, List thrown,
            Node body) {
        return build(modifiers, astUtils.nameFromString(name), resType, typarams, params, thrown, body);
    }

    @Override
    public Node build(JCModifiers modifiers, Name name, JCExpression resType,
            com.sun.tools.javac.util.List typarams,
            com.sun.tools.javac.util.List params, com.sun.tools.javac.util.List thrown,
            Node body) {
        return build(modifiers, name, resType, typarams, params, thrown, body.getObject());
    }

    @Override
    public Node build(JCModifiers modifiers, String name, JCExpression resType,
            List typarams, List params, List thrown, JCBlock body) {
        return build(modifiers, astUtils.nameFromString(name), resType, typarams, params, thrown, body);
    }

    @Override
    public Node build(JCModifiers jcModifiers, Name name, JCExpression resType,
            com.sun.tools.javac.util.List typarams,
            com.sun.tools.javac.util.List params, com.sun.tools.javac.util.List thrown,
            JCBlock body) {
        JCMethodDecl jcMethodDecl = treeMaker.MethodDef(jcModifiers, name, resType, typarams, params, thrown,
                body, null);
        return TreeBuilder.buildNode(jcMethodDecl);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy