@Test public void testGlobalInclusionRule() { TypeSpec.Builder builder = TypeSpec.classBuilder("Test"); TypeModel model = mock(TypeModel.class); when(model.getInclusion()).thenReturn(InclusionType.NON_NULL); new JacksonStyle().processGlobalInclusionRule(builder, model); TypeSpec typeSpec = builder.build(); assertEquals("Test", typeSpec.name); assertEquals(1, typeSpec.annotations.size()); AnnotationSpec inclusionAnnotation = typeSpec.annotations.get(0); assertEquals(1, inclusionAnnotation.members.size()); }
@Override public void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel) { AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", typeModel.getInclusion()) .build(); typeSpec.addAnnotation(annotationSpec); }
JacksonStyle extends AnnotatorStyle { @Override public void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel) { AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", typeModel.getInclusion()) .build(); typeSpec.addAnnotation(annotationSpec); } }
JacksonStyle extends AnnotatorStyle { @Override public void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel) { AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", typeModel.getInclusion()) .build(); typeSpec.addAnnotation(annotationSpec); }  }
JacksonStyle extends AnnotatorStyle { @Override public void processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel) { AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", typeModel.getInclusion()) .build(); typeSpec.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 processGlobalInclusionRule(TypeSpec.Builder typeSpec, TypeModel typeModel) { AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonSerialize.class) .addMember("include", "JsonSerialize.Inclusion.$L", typeModel.getInclusion()) .build(); typeSpec.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);  }