Package com.gengoai.function
Class Switch.SwitchBuilder<V>
- java.lang.Object
-
- com.gengoai.function.Switch.SwitchBuilder<V>
-
-
Constructor Summary
Constructors Constructor Description SwitchBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defaultAction(@NonNull SerializableFunction<?,V> function)
Default action.void
defaultNull()
Default null.void
defaultValue(V value)
Default value.<T> void
equals(T value, @NonNull SerializableFunction<T,V> function)
Equals.<T> void
equals(T targetValue, V returnValue)
Equals.<T> void
instanceOf(@NonNull Class<? super T> clazz, @NonNull SerializableFunction<T,V> function)
Instance of.<T> void
instanceOf(@NonNull Class<? super T> clazz, V value)
Instance of.<T> void
isNull(@NonNull SerializableFunction<T,V> function)
Is null.<T,R>
voidwhen(SerializablePredicate<? super T> predicate, @NonNull SerializableFunction<T,R> mapper, @NonNull SerializableFunction<R,V> function)
When.<T> void
when(SerializablePredicate<? super T> predicate, @NonNull SerializableFunction<T,V> function)
When.
-
-
-
Method Detail
-
instanceOf
public <T> void instanceOf(@NonNull @NonNull Class<? super T> clazz, V value)
Instance of.- Type Parameters:
T
- the type parameter- Parameters:
clazz
- the clazzvalue
- the value
-
instanceOf
public <T> void instanceOf(@NonNull @NonNull Class<? super T> clazz, @NonNull @NonNull SerializableFunction<T,V> function)
Instance of.- Type Parameters:
T
- the type parameter- Parameters:
clazz
- the clazzfunction
- the function
-
equals
public <T> void equals(@NonNull T targetValue, @NonNull V returnValue)
Equals.- Type Parameters:
T
- the type parameter- Parameters:
targetValue
- the target valuereturnValue
- the return value
-
equals
public <T> void equals(T value, @NonNull @NonNull SerializableFunction<T,V> function)
Equals.- Type Parameters:
T
- the type parameter- Parameters:
value
- the valuefunction
- the function
-
isNull
public <T> void isNull(@NonNull @NonNull SerializableFunction<T,V> function)
Is null.- Type Parameters:
T
- the type parameter- Parameters:
function
- the function
-
when
public <T> void when(SerializablePredicate<? super T> predicate, @NonNull @NonNull SerializableFunction<T,V> function)
When.- Type Parameters:
T
- the type parameter- Parameters:
predicate
- the predicatefunction
- the function
-
when
public <T,R> void when(SerializablePredicate<? super T> predicate, @NonNull @NonNull SerializableFunction<T,R> mapper, @NonNull @NonNull SerializableFunction<R,V> function)
When.- Type Parameters:
T
- the type parameterR
- the type parameter- Parameters:
predicate
- the predicatemapper
- the mapperfunction
- the function
-
defaultAction
public void defaultAction(@NonNull @NonNull SerializableFunction<?,V> function)
Default action.- Parameters:
function
- the function
-
defaultValue
public void defaultValue(V value)
Default value.- Parameters:
value
- the value
-
defaultNull
public void defaultNull()
Default null.
-
-