Class SchemaObject.BuilderBase<BUILDER extends SchemaObject.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SchemaObject>

java.lang.Object
io.helidon.json.schema.SchemaItem.BuilderBase<BUILDER,PROTOTYPE>
io.helidon.json.schema.SchemaObject.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
SchemaObject.Builder
Enclosing interface:
SchemaObject

public abstract static class SchemaObject.BuilderBase<BUILDER extends SchemaObject.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SchemaObject> extends SchemaItem.BuilderBase<BUILDER,PROTOTYPE> implements Prototype.Builder<BUILDER,PROTOTYPE>
Fluent API builder base for SchemaObject.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(SchemaObject prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(SchemaObject.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • addSchema

      public BUILDER addSchema(String name, Schema schema)
      Add JSON schema property based on the provided schema root type.
      Parameters:
      name - property name
      schema - schema
      Returns:
      updated builder instance
    • clearMaxProperties

      public BUILDER clearMaxProperties()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • maxProperties

      public BUILDER maxProperties(int maxProperties)
      Maximum number of the object properties.
      Parameters:
      maxProperties - maximum number of the properties
      Returns:
      updated builder instance
      See Also:
    • clearMinProperties

      public BUILDER clearMinProperties()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • minProperties

      public BUILDER minProperties(int minProperties)
      Minimum number of the object properties.
      Parameters:
      minProperties - minimum number of the properties
      Returns:
      updated builder instance
      See Also:
    • clearAdditionalProperties

      public BUILDER clearAdditionalProperties()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • additionalProperties

      public BUILDER additionalProperties(boolean additionalProperties)
      Whether any additional properties are allowed. If set to true, all the available properties have to be added via corresponding property methods.
      Parameters:
      additionalProperties - whether are additional properties allowed
      Returns:
      updated builder instance
      See Also:
    • stringProperties

      public BUILDER stringProperties(Map<String,? extends SchemaString> stringProperties)
      Map of all string properties. This method replaces all values with the new ones.
      Parameters:
      stringProperties - all string properties
      Returns:
      updated builder instance
      See Also:
    • addStringProperties

      public BUILDER addStringProperties(Map<String,? extends SchemaString> stringProperties)
      Map of all string properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      stringProperties - all string properties
      Returns:
      updated builder instance
      See Also:
    • addStringProperty

      public BUILDER addStringProperty(String key, SchemaString addStringProperty)
      Map of all string properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addStringProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addStringProperty

      public BUILDER addStringProperty(String key, Consumer<SchemaString.Builder> consumer)
      Map of all string properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • objectProperties

      public BUILDER objectProperties(Map<String,? extends SchemaObject> objectProperties)
      Map of all object properties. This method replaces all values with the new ones.
      Parameters:
      objectProperties - all object properties
      Returns:
      updated builder instance
      See Also:
    • addObjectProperties

      public BUILDER addObjectProperties(Map<String,? extends SchemaObject> objectProperties)
      Map of all object properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      objectProperties - all object properties
      Returns:
      updated builder instance
      See Also:
    • addObjectProperty

      public BUILDER addObjectProperty(String key, SchemaObject addObjectProperty)
      Map of all object properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addObjectProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addObjectProperty

      public BUILDER addObjectProperty(String key, Consumer<SchemaObject.Builder> consumer)
      Map of all object properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • arrayProperties

      public BUILDER arrayProperties(Map<String,? extends SchemaArray> arrayProperties)
      Map of all array properties. This method replaces all values with the new ones.
      Parameters:
      arrayProperties - all array properties
      Returns:
      updated builder instance
      See Also:
    • addArrayProperties

      public BUILDER addArrayProperties(Map<String,? extends SchemaArray> arrayProperties)
      Map of all array properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      arrayProperties - all array properties
      Returns:
      updated builder instance
      See Also:
    • addArrayProperty

      public BUILDER addArrayProperty(String key, SchemaArray addArrayProperty)
      Map of all array properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addArrayProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addArrayProperty

      public BUILDER addArrayProperty(String key, Consumer<SchemaArray.Builder> consumer)
      Map of all array properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • numberProperties

      public BUILDER numberProperties(Map<String,? extends SchemaNumber> numberProperties)
      Map of all number properties. This method replaces all values with the new ones.
      Parameters:
      numberProperties - all number properties
      Returns:
      updated builder instance
      See Also:
    • addNumberProperties

      public BUILDER addNumberProperties(Map<String,? extends SchemaNumber> numberProperties)
      Map of all number properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      numberProperties - all number properties
      Returns:
      updated builder instance
      See Also:
    • addNumberProperty

      public BUILDER addNumberProperty(String key, SchemaNumber addNumberProperty)
      Map of all number properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addNumberProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addNumberProperty

      public BUILDER addNumberProperty(String key, Consumer<SchemaNumber.Builder> consumer)
      Map of all number properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • integerProperties

      public BUILDER integerProperties(Map<String,? extends SchemaInteger> integerProperties)
      Map of all integer properties. This method replaces all values with the new ones.
      Parameters:
      integerProperties - all integer properties
      Returns:
      updated builder instance
      See Also:
    • addIntegerProperties

      public BUILDER addIntegerProperties(Map<String,? extends SchemaInteger> integerProperties)
      Map of all integer properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      integerProperties - all integer properties
      Returns:
      updated builder instance
      See Also:
    • addIntegerProperty

      public BUILDER addIntegerProperty(String key, SchemaInteger addIntegerProperty)
      Map of all integer properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addIntegerProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addIntegerProperty

      public BUILDER addIntegerProperty(String key, Consumer<SchemaInteger.Builder> consumer)
      Map of all integer properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • booleanProperties

      public BUILDER booleanProperties(Map<String,? extends SchemaBoolean> booleanProperties)
      Map of all boolean properties. This method replaces all values with the new ones.
      Parameters:
      booleanProperties - all boolean properties
      Returns:
      updated builder instance
      See Also:
    • addBooleanProperties

      public BUILDER addBooleanProperties(Map<String,? extends SchemaBoolean> booleanProperties)
      Map of all boolean properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      booleanProperties - all boolean properties
      Returns:
      updated builder instance
      See Also:
    • addBooleanProperty

      public BUILDER addBooleanProperty(String key, SchemaBoolean addBooleanProperty)
      Map of all boolean properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addBooleanProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addBooleanProperty

      public BUILDER addBooleanProperty(String key, Consumer<SchemaBoolean.Builder> consumer)
      Map of all boolean properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • nullProperties

      public BUILDER nullProperties(Map<String,? extends SchemaNull> nullProperties)
      Map of all null properties. This method replaces all values with the new ones.
      Parameters:
      nullProperties - all null properties
      Returns:
      updated builder instance
      See Also:
    • addNullProperties

      public BUILDER addNullProperties(Map<String,? extends SchemaNull> nullProperties)
      Map of all null properties. This method keeps existing values, then puts all new values into the map.
      Parameters:
      nullProperties - all null properties
      Returns:
      updated builder instance
      See Also:
    • addNullProperty

      public BUILDER addNullProperty(String key, SchemaNull addNullProperty)
      Map of all null properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      addNullProperty - new value for the key
      Returns:
      updated builder instance
      See Also:
    • addNullProperty

      public BUILDER addNullProperty(String key, Consumer<SchemaNull.Builder> consumer)
      Map of all null properties. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - builder consumer to create new value for the key
      Returns:
      updated builder instance
      See Also:
    • maxProperties

      public Optional<Integer> maxProperties()
      Maximum number of the object properties.
      Returns:
      the max properties
    • minProperties

      public Optional<Integer> minProperties()
      Minimum number of the object properties.
      Returns:
      the min properties
    • additionalProperties

      public Optional<Boolean> additionalProperties()
      Whether any additional properties are allowed. If set to true, all the available properties have to be added via corresponding property methods.
      Returns:
      the additional properties
    • stringProperties

      public Map<String,SchemaString> stringProperties()
      Map of all string properties.
      Returns:
      the string properties
    • objectProperties

      public Map<String,SchemaObject> objectProperties()
      Map of all object properties.
      Returns:
      the object properties
    • arrayProperties

      public Map<String,SchemaArray> arrayProperties()
      Map of all array properties.
      Returns:
      the array properties
    • numberProperties

      public Map<String,SchemaNumber> numberProperties()
      Map of all number properties.
      Returns:
      the number properties
    • integerProperties

      public Map<String,SchemaInteger> integerProperties()
      Map of all integer properties.
      Returns:
      the integer properties
    • booleanProperties

      public Map<String,SchemaBoolean> booleanProperties()
      Map of all boolean properties.
      Returns:
      the boolean properties
    • nullProperties

      public Map<String,SchemaNull> nullProperties()
      Map of all null properties.
      Returns:
      the null properties
    • toString

      public String toString()
      Overrides:
      toString in class SchemaItem.BuilderBase<BUILDER extends SchemaObject.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SchemaObject>
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
      Overrides:
      preBuildPrototype in class SchemaItem.BuilderBase<BUILDER extends SchemaObject.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SchemaObject>
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
      Overrides:
      validatePrototype in class SchemaItem.BuilderBase<BUILDER extends SchemaObject.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SchemaObject>