VitalYAMLConfigProcessor

File processor for VitalConfig instances that want to store data in a .yaml file. Define this processor in VitalConfig.Info to use it.

@VitalConfig.Info(name = "myconfig.yaml", processor = VitalYAMLConfigProcessor.class)
public class MyYamlConfig extends VitalConfig {
}

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val data: MutableMap<String, Any>

The data object this processor will use to serialize the content. E.g., java.util.Properties for a processor that can write and load .properties configs.

Functions

Link copied to clipboard
open override fun deserialize(serializedContent: Map<String, Any>, type: Class<*>): Any?

Deserializes the given serializedContent to the given type returns an initialized instance of it.

Link copied to clipboard
open override fun load(inputStream: InputStream, clazz: Class<*>): Map<String, Any>

Loads the given inputStream into the data of this config and returns a Map of all properties to value mappings.

Link copied to clipboard
open override fun read(key: String): Any?

Reads a single value for the given key from the data of this config.

open override fun read(key: String, def: Any): Any

Reads a single value for the given key from the data of this config. If no value was found, this function will return the given def.

Link copied to clipboard
open override fun save(serializedContent: Map<String, Any>): String

Saves the given serializedContent to the data of this config.

Link copied to clipboard
open override fun serialize(instance: Any): Map<String?, Any>

Serializes the content of the given instance to a Map where each entry is the name and value for each Field of the given instance.

Link copied to clipboard
open override fun write(instance: Any)

Writes the given instance to the file of this config. E.g., the VitalPropertiesConfigProcessor first serialized its content via serialize and then calls write with it.

open override fun write(serializedContent: Map<String, Any>)

Writes the given serializedContent to the file of this config.

open override fun write(key: String, value: Any)

Writes the given value to the property with the given key to the data of this config.