Fzzy Config

Validated Collections

Fzzy Config has validation for lists, maps, and sets. Each of these has intricacies that are more thoroughly explained in the documentation:

Validated Collections 🗗

Validation Conversion

Any ValidatedField can be converted into a list or set using the toList() and toSet() methods, respectively. In addition, collections can be converted to ValidatedChoice using their toChoices() method. The ValidatedField is backing validation for the resulting collection.

//wraps the vararg valued provided with a blank validated field (identifiers in this case). validation with actual bounds and logic can of course be used too
public ValidatedList<Identifier> listFromField = new ValidatedIdentifier().toList(Identifier.of("stick"), Identifier.of("blaze_rod"));

Static Initializers

ValidatedList and Set have static methods that initialize collections of common types, much like java List.of() or kotlin listOf().

public ValidatedList<Integer> validatedIntList = ValidatedList.ofInt(1, 2, 5, 10);
public ValidatedSet<Integer> validatedIntSet = ValidatedSet.ofInt(1, 2, 5, 10);

Map Builders

Validated Maps have builders for simple creation. These builders are "staged", walking you through each stage needed to build it, so are technically pseudo-builders.

public ValidatedMap<Integer, Boolean> myMap = (new ValidatedMap.Builder())
.keyHandler(new ValidatedInt(2, 100, 0)) //first comes the key handler. The default value for this will be the initial value stored in the key when a new entry is added.
.valueHandler(new ValidatedBoolean()) //next the value handler.
.defaults(Map.of(5, true, 10, false, 15, true)) //default map values can be set a variety of ways
.build(); //build!