Class ApplyDefaultsStrategy


  • public class ApplyDefaultsStrategy
    extends Object
    • Constructor Detail

      • ApplyDefaultsStrategy

        public ApplyDefaultsStrategy​(boolean applyPropertyDefaults,
                                     boolean applyPropertyDefaultsIfNull,
                                     boolean applyArrayDefaults)
        Specify which default values to apply. We can apply property defaults only if they are missing or if they are declared to be null in the input json, and we can apply array defaults if they are declared to be null in the input json.

        Note that the walker changes the input object in place. If validation fails, the input object will be changed.

        Parameters:
        applyPropertyDefaults - if true then apply defaults inside json objects if the attribute is missing
        applyPropertyDefaultsIfNull - if true then apply defaults inside json objects if the attribute is explicitly null
        applyArrayDefaults - if true then apply defaults inside json arrays if the attribute is explicitly null
        Throws:
        IllegalArgumentException - if applyPropertyDefaults is false and applyPropertyDefaultsIfNull is true
    • Method Detail

      • shouldApplyPropertyDefaults

        public boolean shouldApplyPropertyDefaults()
      • shouldApplyPropertyDefaultsIfNull

        public boolean shouldApplyPropertyDefaultsIfNull()
      • shouldApplyArrayDefaults

        public boolean shouldApplyArrayDefaults()