@DefaultNonNull @Immutable public class Problem extends Object
A problem is switched "on" or "off" on any part of a model. Any model part (model, instance, instance-property) can have any list of switched-on problems, but every Problem instance can exist only once in each of those. A problem can be reported as-is, but can also have parameters that will be used to construct the message. These parameters however are not part of the identity of the problem; even when parameters differ can you not report the same problem multiple times on the same model part.
| Modifier | Constructor and Description |
|---|---|
|
Problem(Class<?> anchor,
String code) |
protected |
Problem(Class<?> anchor,
String code,
MsgType type,
boolean repeatable) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static Problem |
error(Class<?> anchor,
String code) |
static Problem |
errorList(Class<?> anchor,
String code) |
BundleRef |
getBundle() |
String |
getCode() |
String |
getMessageKey()
Return a unique key for the message as "bundle name" '#' "code".
|
MsgType |
getSeverity() |
int |
hashCode() |
boolean |
isRepeatable() |
<T> void |
off(ProblemModel errors,
T instance)
Switch off this error: remove it from the error(s) list.
|
<T,P> void |
off(ProblemModel errors,
T instance,
PropertyMetaModel<P> property) |
<T,P> void |
off(ProblemModel errors,
T instance,
String property) |
<T> ProblemInstance |
on(ProblemModel errors,
T instance)
Report this error on a specific instance only.
|
<T,P> ProblemInstance |
on(ProblemModel errors,
T instance,
PropertyMetaModel<P> property)
Report this error on the specified instance's property.
|
<T> ProblemInstance |
on(ProblemModel errors,
T instance,
String property) |
String |
toString() |
static Problem |
warning(Class<?> anchor,
String code) |
static Problem |
warningList(Class<?> anchor,
String code) |
<T> ProblemInstance |
when(ProblemModel errors,
T instance,
boolean condition) |
<T> ProblemInstance |
when(ProblemModel errors,
T instance,
String property,
boolean condition) |
public boolean isRepeatable()
public String getCode()
public String getMessageKey()
public MsgType getSeverity()
public BundleRef getBundle()
public <T> void off(@Nonnull ProblemModel errors, @Nonnull T instance)
errors - public <T,P> void off(@Nonnull ProblemModel errors, @Nonnull T instance, @Nonnull PropertyMetaModel<P> property)
public <T,P> void off(@Nonnull ProblemModel errors, @Nonnull T instance, @Nonnull String property)
public <T> ProblemInstance on(@Nonnull ProblemModel errors, @Nonnull T instance)
errors - instance - @Nonnull public <T,P> ProblemInstance on(@Nonnull ProblemModel errors, @Nonnull T instance, @Nonnull PropertyMetaModel<P> property)
errors - instance - property - @Nonnull public <T> ProblemInstance on(@Nonnull ProblemModel errors, @Nonnull T instance, @Nonnull String property)
public <T> ProblemInstance when(@Nonnull ProblemModel errors, @Nonnull T instance, @Nonnull String property, boolean condition)
public <T> ProblemInstance when(@Nonnull ProblemModel errors, @Nonnull T instance, boolean condition)
Copyright © 2017 etc.to. All rights reserved.