ReasonBuffer
Helper class to create properly concatenated reason string for use in method that return String s with reasons.
If no reasons are specified #getReason() will return null
, otherwise it will return a String with all the valid reasons concatenated with a semi-colon separating each one.
An alternative is to use the (very simple) Reasons class or the (much more sophisticated) ReasonBuffer2 .
API
ReasonBuffer.java
class ReasonBuffer {
void append(String reason) (1)
void appendOnCondition(boolean condition, String reason) (2)
String getReason() (3)
}
1 | append(String)
Append a reason to the list of existing reasons. |
2 | appendOnCondition(boolean, String)
Append a reason to the list of existing reasons if the condition flag is true. |
3 | getReason()
Return the combined set of reasons, or |