In - the input type of the matchOut - the type of the result of the matchpublic class Match<In,Out> extends Object
Example usage:
// let be T1 a class, and let be T1a, T1b subclasses of T1
// then, let be T2 a class, and let be T2a, T2b subclasses of T2
// such that T1a corresponds to T2a, T1b corresponds to T2b:
Match m =
Match.of(T1.class, T2.class)
.when(T1a.class, t1aInstance -> ... create an equivalent t2a instance)
.when(T1b.class, t1bInstance -> ... create an equivalent t2b instance)
T1 myT1 = ...;
Result result = myT1.apply(myT1);
// unwrap the result on success, raise an exception otherwise
T2 t2 = result.value();
| Constructor and Description |
|---|
Match() |
| Modifier and Type | Method and Description |
|---|---|
<T extends In> |
apply(T value) |
Match<In,Out> |
defaultValue(Out value) |
static <In,Out> Match<Node<? extends View<?>,?>,Out> |
fromNode(Class<In> inputType,
Class<Out> outputType) |
<T extends In> |
ignore(Function<T,Boolean> type,
Class<T> clazz) |
Match<In,Out> |
inputDecorator(MarshallingMessageDecorator<In> decorator) |
<T extends In> |
missing(Function<In,Boolean> type,
Class<T> clazz)
handle a type by throwing an error.
|
Match<In,Out> |
mode(MarshallingRequest.Mode mode) |
static <In,Out> Match<In,Out> |
of() |
static <In,Out> Match<In,Edge<? extends View<? extends Out>,?>> |
ofEdge(Class<In> inputType,
Class<Out> outputType) |
static <In,Out> Match<In,Node<? extends View<? extends Out>,?>> |
ofNode(Class<In> inputType,
Class<Out> outputType) |
Match<In,Out> |
orElse(Function<In,Out> then) |
Match<In,Out> |
outputDecorator(MarshallingMessageDecorator<Out> decorator) |
<T extends In> |
when(Function<?,Boolean> type,
Function<T,Out> then) |
public static <In,Out> Match<In,Out> of()
public static <In,Out> Match<In,Node<? extends View<? extends Out>,?>> ofNode(Class<In> inputType, Class<Out> outputType)
public static <In,Out> Match<Node<? extends View<?>,?>,Out> fromNode(Class<In> inputType, Class<Out> outputType)
public static <In,Out> Match<In,Edge<? extends View<? extends Out>,?>> ofEdge(Class<In> inputType, Class<Out> outputType)
public <T extends In> Match<In,Out> missing(Function<In,Boolean> type, Class<T> clazz)
public Match<In,Out> inputDecorator(MarshallingMessageDecorator<In> decorator)
public Match<In,Out> outputDecorator(MarshallingMessageDecorator<Out> decorator)
public Match<In,Out> mode(MarshallingRequest.Mode mode)
Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.