@Test public void testInclusionRule() { FieldSpec.Builder builder = FieldSpec.builder(String.class, "test"); FieldModel model = mock(FieldModel.class); when(model.getInclusion()).thenReturn(InclusionType.NON_NULL); new JacksonStyle().processInclusionRule(builder, model); FieldSpec fieldSpec = builder.build(); assertEquals("test", fieldSpec.name); assertEquals(1, fieldSpec.annotations.size()); AnnotationSpec inclusionAnnotation = fieldSpec.annotations.get(0); assertEquals(1, inclusionAnnotation.members.size()); }
@Override public void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { InclusionType inclusion = fieldModel.getInclusion(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", inclusion) .build(); fieldSpec.addAnnotation(annotationSpec); }
JacksonStyle extends AnnotatorStyle { @Override public void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { InclusionType inclusion = fieldModel.getInclusion(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", inclusion) .build(); fieldSpec.addAnnotation(annotationSpec); } }
JacksonStyle extends AnnotatorStyle { @Override public void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { InclusionType inclusion = fieldModel.getInclusion(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", inclusion) .build(); fieldSpec.addAnnotation(annotationSpec); }  }
JacksonStyle extends AnnotatorStyle { @Override public void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { InclusionType inclusion = fieldModel.getInclusion(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", inclusion) .build(); fieldSpec.addAnnotation(annotationSpec); }  @Override void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel); @Override void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel); @Override void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processSubTypeRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processIgnoreUnknownsRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processPropertyOrderRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processConstructorOrderRule(MethodSpec.Builder methodSpec, TypeModel typeModel, List<String> constructorFields); }
JacksonStyle extends AnnotatorStyle { @Override public void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { InclusionType inclusion = fieldModel.getInclusion(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", inclusion) .build(); fieldSpec.addAnnotation(annotationSpec); }  @Override void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel); @Override void processInclusionRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel); @Override void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processSubTypeRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processIgnoreUnknownsRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processPropertyOrderRule(TypeSpec.Builder typeSpec, TypeModel typeModel); @Override void processConstructorOrderRule(MethodSpec.Builder methodSpec, TypeModel typeModel, List<String> constructorFields);  }