JungleConfig resolves how to serialize and deserialize each value through a three-layer type system managed byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/himansaBro/JungleConfig/llms.txt
Use this file to discover all available pages before exploring further.
NativeTypeConverter. The first layer is a registry of built-in TypeConverterAdapter implementations that handle common Java primitives and java.time types. The second layer is a Jackson fallback that handles POJOs, collections, and any type not covered by the registry. The third layer is the pluggable adapter interface itself, which allows you to register custom converters for your own types at construction time.
Built-in Types
JungleConfig ships with ten built-in adapters registered automatically byJungleConfig.getDefaultAdapters(). Each adapter implements the TypeConverterAdapter interface, which declares three methods: getType() returns the simple class name used as the type tag in the config file, ConvertToSave(Object) converts a value to its string representation, and CastToUse(String) parses that string back to the correct Java type.
| Type tag | Java class | getType() return |
|---|---|---|
Boolean | java.lang.Boolean | "Boolean" |
Integer | java.lang.Integer | "Integer" |
String | java.lang.String | "String" |
Long | java.lang.Long | "Long" |
Double | java.lang.Double | "Double" |
Float | java.lang.Float | "Float" |
UUID | java.util.UUID | "UUID" |
LocalDate | java.time.LocalDate | "LocalDate" |
LocalDateTime | java.time.LocalDateTime | "LocalDateTime" |
LocalTime | java.time.LocalTime | "LocalTime" |
POJO and Collection Types
When a value’s class simple name is not found in the adapter registry,NativeTypeConverter falls back to Jackson serialization — provided FALLBACK_TO_SERIALIZE is true (the default in all four built-in factory methods).
For POJOs, use SetPOJO to make the intent explicit. The type tag written to the file will be Json and the value will be the Jackson-serialized JSON string, URL-encoded:
List<String> or Map<String, Integer>, use getCollection with a Jackson TypeReference to preserve generic type information at runtime:
get and getCollection have Optional-returning counterparts — Get and GetCollection — that return Optional.empty() instead of null when a key does not exist.
Type Resolution Order
NativeTypeConverter.ConvertToSave() determines how to serialize a value through the following steps, in order:
- Null check — if the data object is
null, the type tag is immediately set to"null"and the value string is"null". No further steps are evaluated. "Json"explicit hint — ifSet(key, data, type)is called withtypeequal to"Json", Jackson serializes the object immediately, regardless of whether a built-in adapter exists for the class. The type tag stored is"Json".- Class simple name derivation — if the type string passed to
Set(key, data, type)is blank (orSet(key, data)is called without a type), the type string is derived fromdataObj.getClass().getSimpleName()and the process continues to step 4. - Adapter registry lookup — the type string (from step 2 or derived in step 3) is looked up in the adapter registry. If a matching
TypeConverterAdapteris found, itsConvertToSave(Object)method handles serialization. - Jackson fallback — if the type is not in the registry and
FALLBACK_TO_SERIALIZEistrue(the default), Jackson serializes the object to JSON and the type tag is set to"Json". - Exception — if the type is not in the registry and
FALLBACK_TO_SERIALIZEisfalse, anInvalidConfigFormatExceptionis thrown.
Json or the requested class is not in the adapter registry, Jackson’s ConvertToObject is called; otherwise the matching TypeConverterAdapter.CastToUse handles it.
Null Values
Setting a key tonull is fully supported. NativeTypeConverter detects a null data object before any other step and records the type tag as "null" with the value string "null":
Custom Adapters
TheTypeConverterAdapter interface is intentionally minimal:
NativeTypeConverter constructor alongside the defaults. The adapter’s getType() return value is the key used for registry lookup, so it must match the class simple name of the values you intend to store with that adapter.
