Class ConfigNode<T,U>
java.lang.Object
io.github.ttno1.configvalidation.ConfigNode<T,U>
- Type Parameters:
T
- the data type of this nodeU
- the output type of this ConfigNodes's filter.
- Direct Known Subclasses:
ConfigList
,ConfigSpec
Represents a node that should exist in a configuration.
Specifies a data type and a filter that a configuration node should match.
When a node is validated against a ConfigWrapper, the type of the node is verified to be correct and the filter is confirmed to have passed.
Specifies a data type and a filter that a configuration node should match.
When a node is validated against a ConfigWrapper, the type of the node is verified to be correct and the filter is confirmed to have passed.
-
Method Summary
Modifier and TypeMethodDescriptionConfigNode
<T, U> Convenience method that returns a new ConfigNode with the provided consumer appended onto the current filter akin toConfigFilter.thenRun(Consumer)
.validate
(ConfigWrapper configWrapper, String path) Validates this node against the suppliedConfigWrapper
at the specified path.
Checks for existence of the node, valid data type, and filter passage.<V> ConfigNode
<T, V> withFilter
(ConfigFilter<U, V> filter) Convenience method that returns a new ConfigNode with the provided filter appended onto the current filter usingConfigFilter.withFilter(ConfigFilter)
.
-
Method Details
-
withFilter
Convenience method that returns a new ConfigNode with the provided filter appended onto the current filter usingConfigFilter.withFilter(ConfigFilter)
.- Type Parameters:
V
- the return type of the new filter- Parameters:
filter
- the filter to append to the current filter- Returns:
- a new ConfigNode with the provided filter appended onto the current filter
-
thenRun
Convenience method that returns a new ConfigNode with the provided consumer appended onto the current filter akin toConfigFilter.thenRun(Consumer)
.- Parameters:
consumer
- the consumer to append to the current filter- Returns:
- a new ConfigNode with the provided consumer appended onto the current filter
-
validate
Validates this node against the suppliedConfigWrapper
at the specified path.
Checks for existence of the node, valid data type, and filter passage.- Parameters:
configWrapper
- theConfigWrapper
to validate againstpath
- the absolute path of this node in the ConfigWrapper- Returns:
- a
ConfigValidationResult
containing whether the validation was successful and a fail message if it failed - Throws:
NullPointerException
- ifconfigWrapper
orpath
are null
-