public interface ValueProvider
| Modifier and Type | Method and Description |
|---|---|
static ValueProvider |
fromMapping(java.lang.String tag,
java.lang.String value)
Create a value provider which just handles one tag-value pair.
|
static ValueProvider |
fromMapping(java.lang.String k1,
java.lang.String v1,
java.lang.String k2,
java.lang.String v2)
Create a value provider which just handles two tag-value pairs.
|
static ValueProvider |
fromMapping(java.lang.String k1,
java.lang.String v1,
java.lang.String k2,
java.lang.String v2,
java.lang.String k3,
java.lang.String v3,
java.lang.String... moreTagsAndValues)
Create a value provider which just handles three or more tag-value pairs.
|
static ValueProvider |
multi(java.util.function.Function<java.lang.String,java.lang.Iterable<ValueProvider>> multiFunction)
Create a value provider which does only handle multi-values.
|
java.lang.Iterable<ValueProvider> |
multiValue(java.lang.String tag)
Get the value providers for a multiple insertion.
|
static ValueProvider |
parentWrap(ValueProvider parentProvider,
ValueProvider childProvider)
Wrap a provider with a parent provider.
|
java.lang.String |
value(java.lang.String tag)
Get the value which is inserted for a given tag.
|
default ValueProvider |
withParent(ValueProvider parentProvider)
Wrap this provider with the given parent provider.
|
@Nullable java.lang.String value(@NotNull java.lang.String tag)
tag - template tagnull if the tag is unresolvable@Nullable java.lang.Iterable<ValueProvider> multiValue(@NotNull java.lang.String tag)
tag - template tag for the insertionnull if the tag is unresolvable@NotNull default ValueProvider withParent(@NotNull ValueProvider parentProvider)
The returned provider will first try to resolve items with this provider, the fall back to the parent if this provider cannot resolve a tag.
This allows to define a hierarchy of providers.
parentProvider - parent provider for fallback evaluationparentWrap(ValueProvider, ValueProvider)@NotNull static ValueProvider parentWrap(@NotNull ValueProvider parentProvider, @NotNull ValueProvider childProvider)
The returned provider will first try to resolve a tag using the child provider, and try the parent provider if the child cannot resolve the item.
This allows to define a hierarchy of providers.
parentProvider - parent provider used as fallbackchildProvider - child provider used firstwithParent(ValueProvider)@NotNull static ValueProvider fromMapping(@NotNull java.lang.String tag, @NotNull java.lang.String value)
tag - the only possible tagvalue - the associated value@NotNull static ValueProvider fromMapping(@NotNull java.lang.String k1, @NotNull java.lang.String v1, @NotNull java.lang.String k2, @NotNull java.lang.String v2)
k1 - the first possible tagv1 - the value associated with the first tagk2 - the second possible tagv2 - the value associated with the second tag@NotNull static ValueProvider fromMapping(@NotNull java.lang.String k1, @NotNull java.lang.String v1, @NotNull java.lang.String k2, @NotNull java.lang.String v2, @NotNull java.lang.String k3, @NotNull java.lang.String v3, @NotNull java.lang.String... moreTagsAndValues)
k1 - the first possible tagv1 - the value associated with the first tagk2 - the second possible tagv2 - the value associated with the second tagk3 - the third possible tagv3 - the value associated with the third tagmoreTagsAndValues - more tags (even positions) and values (odd positions), an even number of var args is required@NotNull static ValueProvider multi(@NotNull java.util.function.Function<java.lang.String,java.lang.Iterable<ValueProvider>> multiFunction)
multiFunction - multi-value resolve functionmultiFunction