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

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

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

import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.util.Name;

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

public class FieldAccessBuilderImpl extends AbstractBuilder implements FieldAccessBuilder {

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

    @Override
    public  Node build(Node objectRef, String fieldName) {
        return build(objectRef, astUtils.nameFromString(fieldName));
    }

    @Override
    public  Node build(Node objectRef, Name fieldName) {
        JCFieldAccess jcFieldAccess = treeMaker.Select(objectRef.getObject(), fieldName);
        jcFieldAccess.setType(Type.noType);
        return TreeBuilder.buildNode(jcFieldAccess);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy