public final class ContributorDocumentation extends Object
of
, to be compliant to the Java 8 style, for instance Optional.of(Object)
. It is okay to create additional aliases, like empty()
for of()
. Very specific factory methods can be named like this: Xyz.ofSlug(final String slug)
or
this: Xyz.ofName(final String name)
. This naming convention makes clear what parameter type is required for the method compared to the more general method name like: Xyz.of(final String guessWhat)
.
JsonCreator
to mark the right one for the JSON deserialization.
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Conflicting property-based creators: already had [constructor for YOUR_CLASS, annotations: [null]], encountered [constructor for YOUR_CLASS, annotations: [null]]
JsonIgnore
.
java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Could not find creator property with name 'YOUR_PROPERTY_NAME'
indicates that you should annotate a factory method with JsonIgnore
.
@JsonCreator public Xyz(@JsonProperty("id") String id)but with Java 8 it can be just
@JsonCreator public Xyz(final String id)
Base
which implements equals, hashCode and toString with reflection.ProductDiscountValue
to find out how this can be done.JsonTypeInfo
with a property and you have already declared a property with the same name, it will may be written twice with different values, see also Stackoverflow.