I use jackson library and I have @JsonPOJOBuilder class for deserialize JSON. I added @JsonIgnoreProperties for ignore some fields. For example:
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@SuperBuilder
@JsonDeserialize(builder = SubClass.BuilderImpl.class)
public class SubClass extends MainClass {
@JsonPOJOBuilder(withPrefix = "")
@JsonIgnoreProperties({"a1", "a2"})
static final class BuilderImpl
extends builder<SubClass, BuilderImpl> {
}
public SubClass() {
super();
}
}
I need get throw when json with some of ignored field, such as
objectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, true);
How can I do this with annotation or, maybe, exist other variant do this in SubClass?
Thanks a lot.