java - JSON jackson creator: Default Value and nice to have values -


Text after "div class =" itemprop = "text">

I have mandatory fields, to construct a json with default areas (if the value is not set), and Optional (not mandatory) farm. This class is used for D- and serialization. The last Jason should look different, if the example no mandatory field is set or a mandatory value is set, but should be missed.

  @JsonSnakeCase @JsonIgnoreProperties (ignoreUnknown = true) Public square TryoutJson {@JsonCreator Public TryoutJson (@NotBlank @JsonProperty ("Mandatory") Final String Essentials, Setting to Default ... @ What is it for? @Jasonproporty ("valueDefaultedTo5IfNotSet") The last string value DefaultedTo5IfNotSet, @ ... if the value is given, then what's there to set it here? @Jasonproperty "ThisFieldIsNotMAndatory") Final String Itfield IS Notification, Illegal Methods Executes from For example, this Jason String should be created in the constructor used:  
  {" Compulsory ":" mandatoryValue "," valueDefaultedTo5IfNotSet ":" 5 "} {:" mandatoryValue "" mandatory "}  

or

  {"Compulsory": "mandatoryValue", "valueDefaultedTo5IfNotSet": "2", "thisFiel dIsNotMAndatory": "ValueXY"}  

This is possible only for one manufacturer for all this settings is? I do not want to make many constructors for every possible type, it is imported:

  import org.hibernate.validator.constraints.NotBlank; Import com.fasterxml.jackson.annotation.JsonCreator; Import com.fasterxml.jackson.annotation.JsonIgnoreProperties; Import com.fasterxml.jackson.annotation.JsonProperty;  


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -