@Test public void buildFields() throws Exception { underTest.addProperty("foo", TypeName.INT) .addProperty("bar", TypeName.OBJECT) .addProperty("baz", TypeName.BOOLEAN); final List<FieldSpec> actual = underTest.buildFields(); assertThat(actual) .hasSize(3) .doesNotContainNull(); assertThat(actual.get(0)) .hasType(TypeName.INT) .hasName("foo") .hasNoJavadoc() .hasNoAnnotation() .hasModifier(Modifier.PRIVATE, Modifier.FINAL) .hasNoInitializer(); assertThat(actual.get(1)) .hasType(TypeName.OBJECT) .hasName("bar") .hasNoJavadoc() .hasNoAnnotation() .hasModifier(Modifier.PRIVATE, Modifier.FINAL) .hasNoInitializer(); assertThat(actual.get(2)) .hasType(TypeName.BOOLEAN) .hasName("baz") .hasNoJavadoc() .hasNoAnnotation() .hasModifier(Modifier.PRIVATE, Modifier.FINAL) .hasNoInitializer(); }
@Nonnull @Override protected List<FieldSpec> buildFields() { return getProperties() .entrySet() .stream() .map(property -> { final String name = property.getKey(); final TypeName type = property.getValue(); final String fieldName = fieldNamePolicy.convert(name, type); return FieldSpec.builder(type, fieldName) .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build(); }) .collect(Collectors.toList()); }
ModelClassBuilder extends ClassBuilder { @Nonnull @Override protected List<FieldSpec> buildFields() { return getProperties() .entrySet() .stream() .map(property -> { final String name = property.getKey(); final TypeName type = property.getValue(); final String fieldName = fieldNamePolicy.convert(name, type); return FieldSpec.builder(type, fieldName) .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build(); }) .collect(Collectors.toList()); } }
ModelClassBuilder extends ClassBuilder { @Nonnull @Override protected List<FieldSpec> buildFields() { return getProperties() .entrySet() .stream() .map(property -> { final String name = property.getKey(); final TypeName type = property.getValue(); final String fieldName = fieldNamePolicy.convert(name, type); return FieldSpec.builder(type, fieldName) .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build(); }) .collect(Collectors.toList()); } ModelClassBuilder(@Nonnull NamePolicy fieldNameStrategy,
                             @Nonnull NamePolicy methodNameStrategy,
                             @Nonnull NamePolicy parameterNameStrategy); }
ModelClassBuilder extends ClassBuilder { @Nonnull @Override protected List<FieldSpec> buildFields() { return getProperties() .entrySet() .stream() .map(property -> { final String name = property.getKey(); final TypeName type = property.getValue(); final String fieldName = fieldNamePolicy.convert(name, type); return FieldSpec.builder(type, fieldName) .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build(); }) .collect(Collectors.toList()); } ModelClassBuilder(@Nonnull NamePolicy fieldNameStrategy,
                             @Nonnull NamePolicy methodNameStrategy,
                             @Nonnull NamePolicy parameterNameStrategy);  }
ModelClassBuilder extends ClassBuilder { @Nonnull @Override protected List<FieldSpec> buildFields() { return getProperties() .entrySet() .stream() .map(property -> { final String name = property.getKey(); final TypeName type = property.getValue(); final String fieldName = fieldNamePolicy.convert(name, type); return FieldSpec.builder(type, fieldName) .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build(); }) .collect(Collectors.toList()); } ModelClassBuilder(@Nonnull NamePolicy fieldNameStrategy,
                             @Nonnull NamePolicy methodNameStrategy,
                             @Nonnull NamePolicy parameterNameStrategy);   }