org.javalite.activejdbc
Class Errors
java.lang.Object
org.javalite.activejdbc.Errors
- All Implemented Interfaces:
- Map<String,String>
public class Errors
- extends Object
- implements Map<String,String>
Collection of error messages generated by validation process.
- Author:
- Igor Polevoy
- See Also:
Messages}
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Errors
public Errors()
addValidator
protected void addValidator(String attributeName,
Validator validator)
- Adds a validator whose validation failed.
- Parameters:
attributeName - name of attribute for which validation failed.validator - validator.
setLocale
public void setLocale(Locale locale)
- Sets a locale on this instance. All messages returned from
get(Object)
methods will be returned according to rules of Java Resource Bundles.
- Parameters:
locale - locale instance to configure this object.
get
public String get(Object attributeName)
- Provides a message from a resource bundle
activejdbc_messages.
If an there was no validation error generated for the requested attribute, returns null.
- Specified by:
get in interface Map<String,String>
- Parameters:
attributeName - name of attribute in error.
- Returns:
- a message from a resource bundle
activejdbc_messages as configured in a corresponding
validator. If an there was no validation error generated for the requested attribute, returns null.
get
public String get(String attributeName,
Object... params)
- Provides a message from the resource bundle
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}");
}
}
- Parameters:
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.
- Returns:
- a message from the resource bundle
activejdbc_messages with default locale, which is merged
with parameters.
size
public int size()
- Specified by:
size in interface Map<String,String>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Map<String,String>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey in interface Map<String,String>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue in interface Map<String,String>
put
public String put(String key,
String value)
- Specified by:
put in interface Map<String,String>
remove
public String remove(Object key)
- Specified by:
remove in interface Map<String,String>
putAll
public void putAll(Map<? extends String,? extends String> m)
- Specified by:
putAll in interface Map<String,String>
clear
public void clear()
- Specified by:
clear in interface Map<String,String>
keySet
public Set<String> keySet()
- Specified by:
keySet in interface Map<String,String>
values
public Collection<String> values()
- Specified by:
values in interface Map<String,String>
entrySet
public Set<Map.Entry<String,String>> entrySet()
- Specified by:
entrySet in interface Map<String,String>
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2015 JavaLite. All rights reserved.