@Test public void testNamedAsRule() { FieldSpec.Builder builder = FieldSpec.builder(String.class, "test"); FieldModel model = mock(FieldModel.class); when(model.getNamedAs()).thenReturn("TEST"); new JacksonStyle().processNamedAsRule(builder, model); FieldSpec fieldSpec = builder.build(); assertEquals("test", fieldSpec.name); assertEquals(1, fieldSpec.annotations.size()); AnnotationSpec namedAsAnnotation = fieldSpec.annotations.get(0); assertEquals(1, namedAsAnnotation.members.size()); }
@Override public void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { String jsonProperty = fieldModel.getNamedAs(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonProperty.class) .addMember("value", "$S", jsonProperty) .build(); fieldSpec.addAnnotation(annotationSpec); }
JacksonStyle extends AnnotatorStyle { @Override public void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { String jsonProperty = fieldModel.getNamedAs(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonProperty.class) .addMember("value", "$S", jsonProperty) .build(); fieldSpec.addAnnotation(annotationSpec); } }
JacksonStyle extends AnnotatorStyle { @Override public void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { String jsonProperty = fieldModel.getNamedAs(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonProperty.class) .addMember("value", "$S", jsonProperty) .build(); fieldSpec.addAnnotation(annotationSpec); }  }
JacksonStyle extends AnnotatorStyle { @Override public void processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { String jsonProperty = fieldModel.getNamedAs(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonProperty.class) .addMember("value", "$S", jsonProperty) .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 processNamedAsRule(FieldSpec.Builder fieldSpec, FieldModel fieldModel) { String jsonProperty = fieldModel.getNamedAs(); AnnotationSpec annotationSpec = AnnotationSpec.builder(JsonProperty.class) .addMember("value", "$S", jsonProperty) .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);  }