Class CollectionHint.Builder

java.lang.Object
org.instancio.generator.hints.CollectionHint.Builder
Enclosing class:
CollectionHint

public static final class CollectionHint.Builder extends Object
  • Method Details

    • builder

      public static CollectionHint.Builder builder()
    • generateElements

      public CollectionHint.Builder generateElements(int generateElements)
      Indicates how many elements the engine should generate and insert into the collection.
      Parameters:
      generateElements - number of elements to generate
      Returns:
      builder instance
      Since:
      2.0.0
    • nullableElements

      public CollectionHint.Builder nullableElements(boolean nullableElements)
      Indicates whether null elements are allowed to be generated.
      Parameters:
      nullableElements - if true, null elements allowed
      Returns:
      builder instance
      Since:
      2.0.0
    • shuffle

      public CollectionHint.Builder shuffle(boolean shuffle)
      Indicates whether collection elements, once populated, should be randomly shuffled. The shuffle implementation ensures that results are reproducible per given seed.
      Parameters:
      shuffle - if true, elements will be shuffled
      Returns:
      builder instance
      Since:
      2.0.0
    • withElements

      public <T> CollectionHint.Builder withElements(List<? extends T> elements)
      Additional elements to be inserted into the collection by the engine during the population process. This method can be invoked more than once.
      Type Parameters:
      T - element type
      Parameters:
      elements - elements to be inserted into the collection in addition to the random elements generated by the engine
      Returns:
      builder instance
      Since:
      2.0.0
    • build

      public CollectionHint build()
      Builds the object.
      Returns:
      the built instance.