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