Class ObjectValidatorBuilder<V,PARENT,SELF extends ObjectValidatorBuilder<V,PARENT,SELF>>

java.lang.Object
io.github.mmm.validation.main.ObjectValidatorBuilder<V,PARENT,SELF>
Type Parameters:
V - the generic type of the value to validate.
PARENT - the generic type of the parent builder.
SELF - the generic type of this builder itself (this).
All Implemented Interfaces:
io.github.mmm.base.lang.Builder<Validator<? super V>>, ValidatorRegistry<V,SELF>
Direct Known Subclasses:
CharSequenceValidatorBuilder, ComparableValidatorBuilder, ContainerValidatorBuilder, ValidatorBuilderBoolean, ValidatorBuilderObject, ValidatorBuilderPattern, ValidatorBuilderRange

public abstract class ObjectValidatorBuilder<V,PARENT,SELF extends ObjectValidatorBuilder<V,PARENT,SELF>> extends Object implements io.github.mmm.base.lang.Builder<Validator<? super V>>, ValidatorRegistry<V,SELF>
This is the base class to create instances of AbstractValidator using the builder pattern.
Since:
1.0.0
  • Constructor Details

    • ObjectValidatorBuilder

      public ObjectValidatorBuilder(PARENT parent)
      The constructor.
      Parameters:
      parent - the parent builder.
  • Method Details

    • add

      public SELF add(Validator<? super V> validator)
      Specified by:
      add in interface ValidatorRegistry<V,PARENT>
      Parameters:
      validator - the AbstractValidator to add to this builder.
      Returns:
      this build instance for fluent API calls.
    • getValidators

      protected <T> List<Validator<? super T>> getValidators(ObjectValidatorBuilder<T,?,?> builder)
      Type Parameters:
      T - the generic type of the value to validate.
      Parameters:
      builder - the ObjectValidatorBuilder.
      Returns:
      the List of validators.
    • and

      public PARENT and()
      Returns:
      the parent Builder or null if <PARENT> is void.
    • self

      protected SELF self()
      Returns:
      this build instance for fluent API calls.
    • add

      public SELF add(AbstractValidator<? super V> validator)
      Parameters:
      validator - the AbstractValidator to add to this builder.
      Returns:
      this build instance for fluent API calls.
    • mandatory

      public SELF mandatory()
      Value is mandatory.
      Returns:
      this build instance for fluent API calls.
    • min

      public SELF min(String min)
      This method allows to define a minimum. Values exceeding this minimum will be invalid. Avoid using min(String) and max(String) and use range(String, String) in such case.
      Parameters:
      min - the minimum value allowed.
      Returns:
      this build instance for fluent API calls.
    • max

      public SELF max(String max)
      This method allows to define a maximum. Values exceeding this maximum will be invalid.
      Parameters:
      max - the maximum value allowed.
      Returns:
      this build instance for fluent API calls.
    • range

      public abstract SELF range(String min, String max)
      This method allows to define a range in a generic way. If you have a properly typed builder please use more specific methods such as ComparableValidatorBuilder.range(io.github.mmm.base.range.Range) instead.
      Parameters:
      min - the minimum value allowed or null for no lower bound.
      max - the maximum value allowed or null for no upper bound.
      Returns:
      this build instance for fluent API calls.
    • build

      public Validator<? super V> build()
      Specified by:
      build in interface io.github.mmm.base.lang.Builder<V>
      Returns:
      the AbstractValidator