ReasonBuffer2
Helper class to construct reason strings, with support for evaluating the condition.
An alternative is to use the (very simple) Reasons class or the (a bit more sophisticated) ReasonBuffer .
API
ReasonBuffer2.java
class ReasonBuffer2 {
Builder builder()
ReasonBuffer2 forAll()
ReasonBuffer2 forSingle()
ReasonBuffer2 forAll(String prefix)
ReasonBuffer2 forSingle(String prefix)
ReasonBuffer2 append(LazyReason lazyReason)
void appendIfNotPresent(Optional<?> optional, String reason)
ReasonBuffer2 append(String reason) (1)
ReasonBuffer2 append(boolean condition, String reason) (2)
ReasonBuffer2 append(Condition condition, String reason) (3)
String getReason() (4)
String appendReason(StringBuilder buf) (5)
ReasonBuffer2 plus(ReasonBuffer2 other) (6)
}
1 | append(String)
Append a reason to the list of existing reasons. |
2 | append(boolean, String)
Append a reason to the list of existing reasons if the condition flag is true. |
3 | append(Condition, String)
Append a reason to the list of existing reasons if the condition flag is true. |
4 | getReason()
Return the combined set of reasons, or |
5 | appendReason(StringBuilder)
Appends reasons. |
6 | plus(ReasonBuffer2)
Combines sets of reasons from another. |