Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 @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;
 }