protected void addBaseViewFieldsAndMethodImpls(
      SourceGenerationContext context, JavaClassSource viewClass) {
    StringBuffer inputNames = new StringBuffer();
    StringBuffer readOnlyMethodSrc = new StringBuffer();

    for (FieldDefinition fieldDefinition : context.getFormDefinition().getFields()) {

      if ((fieldDefinition.isAnnotatedId() && !displaysId()) || isBanned(fieldDefinition)) continue;

      InputCreatorHelper helper = creatorHelpers.get(fieldDefinition.getCode());
      if (helper == null) continue;

      PropertySource<JavaClassSource> property =
          viewClass.addProperty(getWidgetFromHelper(helper), fieldDefinition.getName());

      FieldSource<JavaClassSource> field = property.getField();
      field.setPrivate();

      initializeProperty(helper, context, fieldDefinition, field);

      if (helper instanceof RequiresCustomCode)
        ((RequiresCustomCode) helper).addCustomCode(fieldDefinition, context, viewClass);

      if (!(fieldDefinition instanceof SubFormFieldDefinition)) {
        field
            .addAnnotation(ERRAI_BOUND)
            .setStringValue("property", fieldDefinition.getBindingExpression());
      }

      field.addAnnotation(ERRAI_DATAFIELD);

      property.removeAccessor();
      property.removeMutator();

      inputNames.append("inputNames.add(\"").append(fieldDefinition.getName()).append("\");");
      readOnlyMethodSrc.append(helper.getReadonlyMethod(fieldDefinition.getName(), READONLY_PARAM));
    }

    viewClass
        .addMethod()
        .setName("initInputNames")
        .setBody(inputNames.toString())
        .setPublic()
        .setReturnTypeVoid()
        .addAnnotation(JAVA_LANG_OVERRIDE);

    if (isEditable()) {
      MethodSource<JavaClassSource> readonlyMethod =
          viewClass
              .addMethod()
              .setName("setReadOnly")
              .setBody(readOnlyMethodSrc.toString())
              .setPublic()
              .setReturnTypeVoid();
      readonlyMethod.addParameter(boolean.class, SourceGenerationUtil.READONLY_PARAM);
      readonlyMethod.addAnnotation(JAVA_LANG_OVERRIDE);
    }
  }
 @PostConstruct
 protected void init() {
   for (InputCreatorHelper helper : creatorInstances) {
     creatorHelpers.put(helper.getSupportedFieldType(), helper);
   }
 }