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

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

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

import java.util.Collections;
import java.util.List;

import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCCatch;
import com.sun.tools.javac.tree.JCTree.JCTry;
import com.sun.tools.javac.tree.TreeMaker;

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

public class TryBuilderImpl extends AbstractBuilder implements TryBuilder {

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

    @Override
    public Node build(Node body, Node catchers) {
        return build(body, Collections.singletonList(catchers));
    }

    @Override
    public Node build(Node body, List> catchers) {
        return build(body, astUtils.mapNodesToJCListOfObjects(catchers));
    }

    @Override
    public Node build(Node body, com.sun.tools.javac.util.List catchers) {
        JCTry jcTry = treeMaker.Try(body.getObject(), catchers, null);
        return TreeBuilder.buildNode(jcTry);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy