| Constructor and Description |
|---|
Errors() |
| Modifier and Type | Method and Description |
|---|---|
void |
addValidator(String attributeName,
Validator validator)
Adds a validator whose validation failed.
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,String>> |
entrySet() |
String |
get(Object attributeName)
Provides a message from a resource bundle
activejdbc_messages. |
String |
get(String attributeName,
Object... params)
Provides a message from the resource bundle
activejdbc_messages which is merged
with parameters. |
boolean |
isEmpty() |
Set<String> |
keySet() |
String |
put(String key,
String value) |
void |
putAll(Map<? extends String,? extends String> m) |
String |
remove(Object key) |
void |
setLocale(Locale locale)
Sets a locale on this instance.
|
int |
size() |
String |
toJSON() |
String |
toString() |
Collection<String> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllpublic void addValidator(String attributeName, Validator validator)
attributeName - name of attribute for which validation failed.validator - validator.public void setLocale(Locale locale)
get(Object)
methods will be returned according to rules of Java Resource Bundles.locale - locale instance to configure this object.public String get(Object attributeName)
activejdbc_messages.
If an there was no validation error generated for the requested attribute, returns null.get in interface Map<String,String>attributeName - name of attribute in error.activejdbc_messages as configured in a corresponding
validator. If an there was no validation error generated for the requested attribute, returns null.public String get(String attributeName, Object... params)
activejdbc_messages which is merged
with parameters. This methods expects the message in the resource bundle to be parametrized.
This message is configured for a validator using a Fluent Interface when declaring a validator:
public class Temperature extends Model {
static{
validateRange("temp", 0, 100).message("temperature cannot be less than {0} or more than {1}");
}
}
attributeName - name of attribute in error.params - list of parameters for a message. The order of parameters in this list will correspond to the
numeric order in the parameters listed in the message and has nothing to do with a physical order. This means
that the 0th parameter in the list will correspond to {0}, 1st to {1} and so on.activejdbc_messages with default locale, which is merged
with parameters.public boolean containsKey(Object key)
containsKey in interface Map<String,String>public boolean containsValue(Object value)
containsValue in interface Map<String,String>public String toJSON()
Copyright © 2022 JavaLite. All rights reserved.