Package com.kamikazejam.kamicommon.yaml
Class AbstractYamlHandler<T extends AbstractYamlConfiguration>
java.lang.Object
com.kamikazejam.kamicommon.yaml.AbstractYamlHandler<T>
- Direct Known Subclasses:
YamlHandlerStandalone
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal @NotNull AbstractConfig<?>final @Nullable Supplier<InputStream>final @NotNull ConfigSource -
Constructor Summary
ConstructorsConstructorDescriptionAbstractYamlHandler(@NotNull AbstractConfig<?> abstractConfig, @NotNull ConfigSource source, @Nullable Supplier<InputStream> defaultsStream) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.yaml.snakeyaml.nodes.MappingNodeabstract voidabstract TnewConfig(@NotNull org.yaml.snakeyaml.nodes.MappingNode node, @NotNull ConfigSource source) abstract @NotNull MemorySectionMethods<?>newMemorySection(@NotNull org.yaml.snakeyaml.nodes.MappingNode node) booleansave()Saves the config to the fileabstract void
-
Field Details
-
abstractConfig
-
source
-
defaultsStream
-
config
-
-
Constructor Details
-
AbstractYamlHandler
public AbstractYamlHandler(@NotNull @NotNull AbstractConfig<?> abstractConfig, @NotNull @NotNull ConfigSource source, @Nullable @Nullable Supplier<InputStream> defaultsStream) - Parameters:
abstractConfig- The parent config instance who holds this handler.source- The source of the configuration file (yaml content).defaultsStream- An optional stream (of a YAML config) to read default values from, can be null.
-
-
Method Details
-
newConfig
@NotNull public abstract T newConfig(@NotNull @NotNull org.yaml.snakeyaml.nodes.MappingNode node, @NotNull @NotNull ConfigSource source) -
newMemorySection
@NotNull public abstract @NotNull MemorySectionMethods<?> newMemorySection(@NotNull @NotNull org.yaml.snakeyaml.nodes.MappingNode node) -
error
-
warn
-
loadConfig
-
save
@Internal public boolean save()Saves the config to the file- Returns:
- true IFF the config was saved successfully (can be skipped if the config is not changed)
-
createNewMappingNode
@NotNull public static @NotNull org.yaml.snakeyaml.nodes.MappingNode createNewMappingNode()
-