@Test public void testPrimitiveField(@TuneProvider Tune tune) { FieldSpec.Builder builder = FieldSpec.builder(String.class, "test"); FieldModel model = mock(FieldModel.class); when(model.isPrimitive()).thenReturn(true); new NotRequiredRule(tune, null).process(builder, model); FieldSpec spec = builder.build(); assertEquals("test", spec.name, "Wrong name found."); assertEquals(0, spec.annotations.size(), "Annotations found."); }
@Override public void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { if (fieldModel.isRequired() || (fieldModel.isPrimitive() && !fieldModel.isArray())) { return; } tune.getValidationAnnotatorStyles().forEach(style -> style.processNotRequiredRule(fieldSpec, fieldModel)); }
NotRequiredRule extends FieldRule { @Override public void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { if (fieldModel.isRequired() || (fieldModel.isPrimitive() && !fieldModel.isArray())) { return; } tune.getValidationAnnotatorStyles().forEach(style -> style.processNotRequiredRule(fieldSpec, fieldModel)); } }
NotRequiredRule extends FieldRule { @Override public void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { if (fieldModel.isRequired() || (fieldModel.isPrimitive() && !fieldModel.isArray())) { return; } tune.getValidationAnnotatorStyles().forEach(style -> style.processNotRequiredRule(fieldSpec, fieldModel)); } NotRequiredRule(Tune tune, MetaInfo metaInfo); }
NotRequiredRule extends FieldRule { @Override public void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { if (fieldModel.isRequired() || (fieldModel.isPrimitive() && !fieldModel.isArray())) { return; } tune.getValidationAnnotatorStyles().forEach(style -> style.processNotRequiredRule(fieldSpec, fieldModel)); } NotRequiredRule(Tune tune, MetaInfo metaInfo); @Override void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel); }
NotRequiredRule extends FieldRule { @Override public void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { if (fieldModel.isRequired() || (fieldModel.isPrimitive() && !fieldModel.isArray())) { return; } tune.getValidationAnnotatorStyles().forEach(style -> style.processNotRequiredRule(fieldSpec, fieldModel)); } NotRequiredRule(Tune tune, MetaInfo metaInfo); @Override void process(FieldSpec.Builder fieldSpec, FieldModel fieldModel);  }