public FieldDecl addField( final TYPE_TYPE type, TypeRef fieldType, String fieldName, Expression<?> initialization) { final FieldDecl fieldDecl = FieldDecl(fieldType, fieldName).makePrivate(); if (initialization != null) { fieldDecl.withInitialization(initialization); } type.editor().injectField(fieldDecl); return fieldDecl; }
public FieldDecl addField( final TYPE_TYPE type, MethodDescriptor.Type fieldType, String fieldName, Expression<?> initialization) { final FieldDecl fieldDecl = FieldDecl(asTypeRef(fieldType), fieldName).makePrivate(); if (initialization != null) fieldDecl.withInitialization(initialization); type.editor().injectField(fieldDecl); return fieldDecl; }
@Override public JCTree visitFieldDecl(final lombok.ast.FieldDecl node, final Void p) { final JCModifiers mods = setGeneratedBy( M(node) .Modifiers( flagsFor(node.getModifiers()), build(node.getAnnotations(), JCAnnotation.class)), source); final JCExpression vartype = build(node.getType()); final JCExpression init = build(node.getInitialization()); final JCVariableDecl field = setGeneratedBy(M(node).VarDef(mods, name(node.getName()), vartype, init), source); return field; }