Class ConditionMessage
- java.lang.Object
- org.springframework.boot.autoconfigure.condition.ConditionMessage
public final class ConditionMessage extends Object
A message associated with aConditionOutcome
. Provides a fluent builder style API to encourage consistency across all condition messages.- Since:
- 1.4.1
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ConditionMessage.Builder
Builder used to create aConditionMessage
for a condition.class
ConditionMessage.ItemsBuilder
Builder used to create aConditionMessage.ItemsBuilder
for a condition.static class
ConditionMessage.Style
Render styles.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConditionMessage.Builder
andCondition(Class<? extends Annotation> condition, Object... details)
Return a new builder to construct a newConditionMessage
based on the instance and a new condition outcome.ConditionMessage.Builder
andCondition(String condition, Object... details)
Return a new builder to construct a newConditionMessage
based on the instance and a new condition outcome.ConditionMessage
append(String message)
Return a newConditionMessage
based on the instance and an appended message.static ConditionMessage
empty()
Factory method to return a new emptyConditionMessage
.boolean
equals(Object obj)
static ConditionMessage.Builder
forCondition(Class<? extends Annotation> condition, Object... details)
Factory method for a builder to construct a newConditionMessage
for a condition.static ConditionMessage.Builder
forCondition(String condition, Object... details)
Factory method for a builder to construct a newConditionMessage
for a condition.int
hashCode()
boolean
isEmpty()
Returntrue
if the message is empty.static ConditionMessage
of(String message, Object... args)
Factory method to create a newConditionMessage
with a specific message.static ConditionMessage
of(Collection<? extends ConditionMessage> messages)
Factory method to create a newConditionMessage
comprised of the specified messages.String
toString()
Method Detail
isEmpty
public boolean isEmpty()
Returntrue
if the message is empty.- Returns:
- if the message is empty
append
public ConditionMessage append(String message)
Return a newConditionMessage
based on the instance and an appended message.- Parameters:
message
- the message to append- Returns:
- a new
ConditionMessage
instance
andCondition
public ConditionMessage.Builder andCondition(Class<? extends Annotation> condition, Object... details)
Return a new builder to construct a newConditionMessage
based on the instance and a new condition outcome.- Parameters:
condition
- the conditiondetails
- details of the condition- Returns:
- a
ConditionMessage.Builder
builder - See Also:
andCondition(String, Object...)
,forCondition(Class, Object...)
andCondition
public ConditionMessage.Builder andCondition(String condition, Object... details)
Return a new builder to construct a newConditionMessage
based on the instance and a new condition outcome.- Parameters:
condition
- the conditiondetails
- details of the condition- Returns:
- a
ConditionMessage.Builder
builder - See Also:
andCondition(Class, Object...)
,forCondition(String, Object...)
empty
public static ConditionMessage empty()
Factory method to return a new emptyConditionMessage
.- Returns:
- a new empty
ConditionMessage
of
public static ConditionMessage of(String message, Object... args)
Factory method to create a newConditionMessage
with a specific message.- Parameters:
message
- the source message (may be a format string ifargs
are specified)args
- format arguments for the message- Returns:
- a new
ConditionMessage
instance
of
public static ConditionMessage of(Collection<? extends ConditionMessage> messages)
Factory method to create a newConditionMessage
comprised of the specified messages.- Parameters:
messages
- the source messages (may benull
)- Returns:
- a new
ConditionMessage
instance
forCondition
public static ConditionMessage.Builder forCondition(Class<? extends Annotation> condition, Object... details)
Factory method for a builder to construct a newConditionMessage
for a condition.- Parameters:
condition
- the conditiondetails
- details of the condition- Returns:
- a
ConditionMessage.Builder
builder - See Also:
forCondition(String, Object...)
,andCondition(String, Object...)
forCondition
public static ConditionMessage.Builder forCondition(String condition, Object... details)
Factory method for a builder to construct a newConditionMessage
for a condition.- Parameters:
condition
- the conditiondetails
- details of the condition- Returns:
- a
ConditionMessage.Builder
builder - See Also:
forCondition(Class, Object...)
,andCondition(String, Object...)