Supported Decoders
| Type | details | 
|---|---|
| Array | Java primitive array type with any generic class, Can decode simple types from a single comma separated value, or from an array node. You can escape the comma with a \, so the values are not split. | 
| BigDecimal | |
| BigInteger | |
| Boolean | Boolean and boolean | 
| Byte | Byte and byte | 
| Char | Char and char | 
| ConfigContainer | A container that caches your config value, and updates it when there is a configuration change. | 
| Date | takes a DateTimeFormatter as a parameter, by default it uses DateTimeFormatter.ISO_DATE_TIME | 
| Double | Double and double | 
| Duration | Decodes a duration from either a number or an ISO 8601 standardized string format like "PT42S". | 
| Enum | |
| File | |
| Float | Float and float | 
| Instant | |
| Integer | Integer and int | 
| List | a Java list with any Generic class, Can decode simple types from a single comma separated value, or from an array node. You can escape the comma with a \, so the values are not split. Supports multiple varieties of List such as AbstractList, CopyOnWriteArrayList, ArrayList, LinkedList, Stack, Vector, and SequencedCollection. If asked for a List it will default to an ArrayList. | 
| LocalDate | Takes a DateTimeFormatter as a parameter, by default it uses DateTimeFormatter.ISO_LOCAL_DATE | 
| LocalDateTime | Takes a DateTimeFormatter as a parameter, by default it uses DateTimeFormatter.ISO_DATE_TIME | 
| Long | Long or long | 
| Map | A map, Assumes that the key is a simple class that can be decoded from a single string. ie a Boolean, String, Int. The value can be any type we can decode. Supports parsing a map from a string with the format key1=value1, key2=value2. You can escape the comma with a \, so the values are not split. Supports multiple varieties of Maps such as HashMap, TreeMap, ArrayList, LinkedHashMap and SequencedMap. If asked for a Map it will default to an HashMap. | 
| Object | Decodes a java Bean style class, although it will work with any java class. Will fail if the constructor is private. Will construct the class even if there are missing values, the values will be null or the default. Then it will return errors which you can disable using treatMissingValuesAsErrors = true. Decodes member classes and lists as well. | 
| Optional | Decodes an optional value, if no value is found it will return an Optional.empty() | 
| OptionalDouble | Decodes an optional Double, if no value is found it will return an OptionalDouble.empty() | 
| OptionalInt | Decodes an optional Integer, if no value is found it will return an OptionaInt.empty() | 
| OptionalLong | Decodes an optional Long, if no value is found it will return an OptionalLong.empty() | 
| Path | |
| Pattern | |
| Proxy (interface) | Will create a proxy for an interface that will return the config value based on the java bean method name. So a method "getCar()" would match a config named "car". If a config is missing it will call the default method if provided. Has 2 modes, Cached and pass-through, the default is Cached. Cached  will receive a cache of all values on creation and return those from an internal cache. Pass-though will result the object on creation, but when calling to get the values it will call gestalt for each value. This allows you to always get the most recent values. To set the mode on the builder use Gestalt gestalt = builder.setProxyDecoderMode(ProxyDecoderMode.PASSTHROUGH) | 
| Record | Decodes a Java record. All members of the record must have a value or construction will fail.So unlike the Object decoder it will not have the option to default to null or provide defaults. Will construct the record even if there are extra values, it will ignore all extra values. | 
| Sealed Class | Decodes a Java Sealed Class. It will attempt to find the best match by attempting to decoding each permitted class. Any missing value or failed decodes will increase the score, and the difference in config nodes and class fields will increase the score. The lowest score wins and is returned. | 
| Set | A Set with any Generic class, Can decode simple types from a single comma separated value, or from an array node. You can escape the comma with a \, so the values are not split. Provides an unordered HashSet. Supports multiple varieties of Sets such as HashSet, TreeSet, LinkedHashSet, LinkedHashMap and SequencedSet. If asked for a Set it will default to an HashSet. | 
| Short | Short or short | 
| String | |
| StringConstructor | Will decode a class that has a constructor that accepts a single string. This will only match for leaf nodes. It will send the value of the leaf node to the String constructor. | 
| UUID | 
For Kotlin, the kotlin specific decoders are only selected when calling from the Kotlin Gestalt extension functions, or when using KTypeCapture. Otherwise, it will match the Java decoder. Kotlin decoders: Boolean, Byte, Char, Data class, Double, Duration, Float, Integer, Long, Short, String
For kotlin data classes it builds a Kotlin Data class by creating a map of parameters. If there are any missing required parameters it will fail.
Required parameters are ones that don't have a default and are not nullable. An exception will be thrown in this case.
If all members are optional, and we have no parameters we will try and create the class with the default PlaceHolder constructor.
If you didn't manually add any Decoders as part of the GestaltBuilder, it will add the defaults. The GestaltBuilder uses the service loader to create instances of the Decoders. It will configure them by passing in the GestaltConfig to applyConfig. To register your own default Decoders add them to the builder, or add it to a file in META-INF\services\org.github.gestalt.config.decoder.Decoder and add the full path to your Decoder