public class DefaultFunction<T,M extends Metadata> extends java.lang.Object implements Function<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> |
function |
protected M |
metadata |
| Constructor and Description |
|---|
DefaultFunction(M metadata,
java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> function) |
| Modifier and Type | Method and Description |
|---|---|
StepCondition |
allMatch(java.util.Collection<T> values)
Returns a step condition checking if the node value matches all of the given values.
|
StepCondition |
allMatch(java.util.List<java.util.function.Predicate<T>> values,
java.lang.String... predicateReadables)
Returns a step condition checking if all of the given predicates testing the node value match.
|
StepCondition |
allMatch(T... values)
Returns a step condition checking if the node value matches all of the given values.
|
StepCondition |
anyMatch(java.util.Collection<T> values)
Returns a step condition checking if the node value matches any of the given values.
|
StepCondition |
anyMatch(java.util.List<java.util.function.Predicate<T>> values,
java.lang.String... predicateReadables)
Returns a step condition checking if any of the given predicates testing the node value match.
|
StepCondition |
anyMatch(T... values)
Returns a step condition checking if the node value matches any of the given values.
|
StepCondition |
eq(BaseFieldInfo<T> value)
Returns a step condition checking if the node value is equal to the given supplier value.
|
StepCondition |
eq(Function<T> value)
Returns a step condition checking if the node value is equal to the given supplier value.
|
StepCondition |
eq(java.util.function.Supplier<T> supplier)
Deprecated.
use
eq(Object) or eq(Function) instead |
StepCondition |
eq(T value)
Returns a step condition checking if the node value is equal to the given value.
|
java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> |
getFunction() |
M |
getMetadata() |
StepCondition |
isNotNull()
Returns a step condition checking if the node value is not null.
|
StepCondition |
isNull()
Returns a step condition checking if the node value is null.
|
<R> DefaultFunction<R,MapFunctionMetadata> |
map(java.lang.String readable,
java.util.function.Function<T,R> mapper)
Returns a default step condition that returns the node value mapped by the given function.
|
IntegerFunction |
mapToInt(java.util.function.Function<T,java.lang.Integer> mapper)
Deprecated.
use
mapToInt(String, java.util.function.Function) instead |
IntegerFunction |
mapToInt(java.lang.String readable,
java.util.function.Function<T,java.lang.Integer> mapper)
Returns an integer step condition that returns the node value mapped by the given mapper.
|
StringFunction |
mapToString(java.util.function.Function<T,java.lang.String> mapper)
Deprecated.
use
mapToString(String, java.util.function.Function) instead |
StringFunction |
mapToString(java.lang.String readable,
java.util.function.Function<T,java.lang.String> mapper)
Returns a string step condition that returns the node value mapped by the given function.
|
<U,R> DefaultFunction<R,MapFunctionMetadata> |
mapUsing(java.lang.String readable,
Function<U> condition,
java.util.function.BiFunction<T,U,R> mapper)
Returns an default step condition that returns the node value mapped by the given function.
|
StepCondition |
noneMatch(java.util.Collection<T> values)
Returns a step condition checking if the node value matches none of the given values.
|
StepCondition |
noneMatch(java.util.List<java.util.function.Predicate<T>> values,
java.lang.String... predicateReadables)
Returns a step condition checking if none of the given predicates testing the node value match.
|
StepCondition |
noneMatch(T... values)
Returns a step condition checking if the node value matches none of the given values.
|
StepCondition |
notEq(BaseFieldInfo<T> value)
Returns a step condition checking if the node value is not equal to the given field value.
|
StepCondition |
notEq(Function<T> value)
Returns a step condition checking if the node value is not equal to the given field value.
|
StepCondition |
notEq(java.util.function.Supplier<T> supplier)
Deprecated.
use
notEq(Object) or notEq(Function) instead |
StepCondition |
notEq(T value)
Returns a step condition checking if the node value is not equal to the given value.
|
IntegerFunction |
position()
Returns a integer function encapsulating the position of this encapsulated field.
|
java.lang.String |
readable()
Returns the human readable version of this object.
|
IterableFunction<TagId,java.util.List<TagId>> |
tags()
Returns a iterable function encapsulating the tags of this encapsulated field.
|
java.util.Optional<T> |
value(FieldModel model,
Context context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisUsing, markdown, markdown, readableprotected final java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> function
public DefaultFunction(M metadata, java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> function)
public java.util.Optional<T> value(FieldModel model, Context context)
value in interface ContextAccessor<T>public M getMetadata()
getMetadata in interface Function<T>public java.util.function.BiFunction<FieldModel,Context,java.util.Optional<T>> getFunction()
public java.lang.String readable()
Readablereadable in interface DSLBuilderreadable in interface Readablepublic final IterableFunction<TagId,java.util.List<TagId>> tags()
public final IntegerFunction position()
public final StepCondition isNull()
public final StepCondition isNotNull()
public final StepCondition eq(T value)
value - the right side value@Deprecated public final StepCondition eq(java.util.function.Supplier<T> supplier)
eq(Object) or eq(Function) insteadsupplier - the right side valuepublic final StepCondition eq(BaseFieldInfo<T> value)
value - the right side valuepublic final StepCondition eq(Function<T> value)
value - the right side valuepublic final StepCondition notEq(T value)
value - the right side value@Deprecated public final StepCondition notEq(java.util.function.Supplier<T> supplier)
notEq(Object) or notEq(Function) insteadsupplier - the right side valuepublic final StepCondition notEq(BaseFieldInfo<T> value)
value - the right side valuepublic final StepCondition notEq(Function<T> value)
value - the right side value@SafeVarargs public final StepCondition anyMatch(T... values)
values - the values to matchpublic final StepCondition anyMatch(java.util.Collection<T> values)
values - the values to matchpublic final StepCondition anyMatch(java.util.List<java.util.function.Predicate<T>> values, java.lang.String... predicateReadables)
values - the values to matchpredicateReadables - strings defining predicates in order@SafeVarargs public final StepCondition allMatch(T... values)
values - the values to matchpublic final StepCondition allMatch(java.util.Collection<T> values)
values - the values to matchpublic final StepCondition allMatch(java.util.List<java.util.function.Predicate<T>> values, java.lang.String... predicateReadables)
values - the values to matchpredicateReadables - strings defining predicates in order@SafeVarargs public final StepCondition noneMatch(T... values)
values - the values to matchpublic final StepCondition noneMatch(java.util.Collection<T> values)
values - the values to matchpublic final StepCondition noneMatch(java.util.List<java.util.function.Predicate<T>> values, java.lang.String... predicateReadables)
values - the values to matchpredicateReadables - strings defining predicates in order@Deprecated public final IntegerFunction mapToInt(java.util.function.Function<T,java.lang.Integer> mapper)
mapToInt(String, java.util.function.Function) insteadmapper - the to integer mapper to applypublic final IntegerFunction mapToInt(java.lang.String readable, java.util.function.Function<T,java.lang.Integer> mapper)
readable - descriptor string for the mapper functionmapper - the to integer mapper to apply@Deprecated public final StringFunction mapToString(java.util.function.Function<T,java.lang.String> mapper)
mapToString(String, java.util.function.Function) insteadmapper - function to string mapper to applypublic final StringFunction mapToString(java.lang.String readable, java.util.function.Function<T,java.lang.String> mapper)
readable - descriptor string for the mapper functionmapper - function to string mapper to applypublic final <R> DefaultFunction<R,MapFunctionMetadata> map(java.lang.String readable, java.util.function.Function<T,R> mapper)
R - target typereadable - text describing the functionmapper - mapper function to applypublic final <U,R> DefaultFunction<R,MapFunctionMetadata> mapUsing(java.lang.String readable, Function<U> condition, java.util.function.BiFunction<T,U,R> mapper)
U - condition typeR - target typereadable - descriptioncondition - conditionmapper - mapper function to apply