예제 #1
0
 private void generatePropertyNameConstant(
     final TYPE_TYPE type, final FIELD_TYPE field, final String propertyNameFieldName) {
   String propertyName = field.name();
   if (type.hasField(propertyNameFieldName)) return;
   type.injectField(
       FieldDecl(Type(String.class), propertyNameFieldName)
           .makePublic()
           .makeStatic()
           .makeFinal() //
           .withInitialization(String(propertyName)));
 }
 private void generateVetoableChangeSupportFields(final TYPE_TYPE type) {
   if (!type.hasField(VETOABLE_CHANGE_SUPPORT_FIELD_NAME)) {
     type.editor()
         .injectField(
             FieldDecl(Type(VetoableChangeSupport.class), VETOABLE_CHANGE_SUPPORT_FIELD_NAME)
                 .makePrivate()
                 .makeTransient()
                 .makeVolatile());
   }
   if (!type.hasField(VETOABLE_CHANGE_SUPPORT_FIELD_NAME + "Lock")) {
     type.editor()
         .injectField(
             FieldDecl(
                     Type(Object.class).withDimensions(1),
                     VETOABLE_CHANGE_SUPPORT_FIELD_NAME + "Lock")
                 .makePrivate()
                 .makeFinal() //
                 .withInitialization(
                     NewArray(Type(Object.class)).withDimensionExpression(Number(0))));
   }
 }