Search in sources :

Example 1 with StatementMaker

use of lombok.javac.handlers.JavacSingularsRecipes.StatementMaker in project lombok by rzwitserloot.

the class HandleSuperBuilder method generateSetterMethodsForBuilder.

private void generateSetterMethodsForBuilder(final SuperBuilderJob job, BuilderFieldData fieldNode, final String builderGenericName, String setterPrefix) {
    boolean deprecate = isFieldDeprecated(fieldNode.originalFieldNode);
    final JavacTreeMaker maker = job.getTreeMaker();
    ExpressionMaker returnTypeMaker = new ExpressionMaker() {

        @Override
        public JCExpression make() {
            return maker.Ident(job.toName(builderGenericName));
        }
    };
    StatementMaker returnStatementMaker = new StatementMaker() {

        @Override
        public JCStatement make() {
            return maker.Return(maker.Apply(List.<JCExpression>nil(), maker.Ident(job.toName(SELF_METHOD)), List.<JCExpression>nil()));
        }
    };
    if (fieldNode.singularData == null || fieldNode.singularData.getSingularizer() == null) {
        generateSimpleSetterMethodForBuilder(job, deprecate, fieldNode.createdFields.get(0), fieldNode.name, fieldNode.nameOfSetFlag, returnTypeMaker.make(), returnStatementMaker.make(), fieldNode.annotations, fieldNode.originalFieldNode, setterPrefix);
    } else {
        fieldNode.singularData.getSingularizer().generateMethods(job.checkerFramework, fieldNode.singularData, deprecate, job.builderType, job.sourceNode, true, returnTypeMaker, returnStatementMaker, AccessLevel.PUBLIC);
    }
}
Also used : StatementMaker(lombok.javac.handlers.JavacSingularsRecipes.StatementMaker) ExpressionMaker(lombok.javac.handlers.JavacSingularsRecipes.ExpressionMaker) JavacTreeMaker(lombok.javac.JavacTreeMaker) JCExpression(com.sun.tools.javac.tree.JCTree.JCExpression)

Aggregations

JCExpression (com.sun.tools.javac.tree.JCTree.JCExpression)1 JavacTreeMaker (lombok.javac.JavacTreeMaker)1 ExpressionMaker (lombok.javac.handlers.JavacSingularsRecipes.ExpressionMaker)1 StatementMaker (lombok.javac.handlers.JavacSingularsRecipes.StatementMaker)1