|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vladnput.types.VladType
public abstract class VladType
The base class for all type validators. Typically, a subclass will define arguments that it handles as string constants and check them in
Field Summary | |
---|---|
static java.lang.String |
ALLOW_EMPTY_KEY
Name of the allow empty argument. |
static java.lang.String |
LEN_VAR
Message variable for the length of the actual value. |
static java.lang.String |
MAX_LEN_KEY
Name of the maximum allowed length argument. |
static java.lang.String |
MIN_LEN_KEY
Name of the minimum required length argument. |
static java.lang.String |
SENSITIVE_KEY
Name of the sensitive argument. |
static java.util.Set<java.lang.String> |
VALID_KEYS
Set of valid argument names |
Constructor Summary | |
---|---|
VladType(java.util.Map<java.lang.String,java.lang.Object> args)
Constructs VladType from args, removing any arguments related to VladMessages or that are recognized by this class (e.g. |
Method Summary | |
---|---|
java.util.List<java.lang.String> |
addMessage(java.util.List<java.lang.String> msgs,
java.lang.String name)
Adds the name of the message for argument name to msgs. |
boolean |
allowEmpty()
|
protected java.lang.Boolean |
booleanKey(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key)
Removes and returns the mapping associated with key in args, or null if there is not one. |
static void |
checkArg(java.lang.String name,
java.lang.Object value,
java.util.Map<java.lang.String,java.lang.Object> args)
Checks argument with name and value for validity. |
protected java.util.Date |
dateKey(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key,
java.text.DateFormat format)
Removes and returns the string mapping associated with key in args after parsing it as a date, or null if there is not one. |
protected java.util.List<java.lang.String> |
doValidate(java.util.List<java.lang.String> msgs,
java.lang.String value,
VladMessageVars vars)
|
protected java.lang.Double |
floatKey(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key)
Removes and returns the mapping associated with key in args, or null if there is not one. |
VladMessages |
getMessages()
Gets the messages for this type. |
protected java.lang.Integer |
integerKey(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key)
Removes and returns the mapping associated with key in args, or null if there is not one. |
boolean |
isSensitive()
|
static java.lang.String |
msgFor(java.lang.String arg)
Returns the name of the message argument for arg. |
protected java.lang.String |
stringKey(java.util.Map<java.lang.String,java.lang.Object> args,
java.lang.String key)
Removes and returns the mapping associated with key in args, or null if there is not one. |
java.lang.String |
toString()
|
java.util.List<java.lang.String> |
validate(java.lang.String value,
VladMessageVars vars)
Checks value for validity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LEN_VAR
public static final java.lang.String MIN_LEN_KEY
public static final java.lang.String MAX_LEN_KEY
public static final java.lang.String SENSITIVE_KEY
public static final java.lang.String ALLOW_EMPTY_KEY
public static final java.util.Set<java.lang.String> VALID_KEYS
Constructor Detail |
---|
public VladType(java.util.Map<java.lang.String,java.lang.Object> args)
args
- Arguments for this typeMethod Detail |
---|
public static void checkArg(java.lang.String name, java.lang.Object value, java.util.Map<java.lang.String,java.lang.Object> args) throws InvalidArgException, InvalidArgValueException
name
- Argument namevalue
- Argument valueargs
- The other arguments for this type
InvalidArgException
- If the argument is invalid
InvalidArgValueException
- If the argument value is invalidpublic static java.lang.String msgFor(java.lang.String arg)
arg
- Argument name
public java.util.List<java.lang.String> addMessage(java.util.List<java.lang.String> msgs, java.lang.String name)
msgs
- List of messages being accumulatedname
- Argument name to add a message for
public VladMessages getMessages()
public final java.util.List<java.lang.String> validate(java.lang.String value, VladMessageVars vars)
value
- Value to validatevars
- Variables to add values to if the value is invalid
protected java.util.List<java.lang.String> doValidate(java.util.List<java.lang.String> msgs, java.lang.String value, VladMessageVars vars)
public boolean isSensitive()
public boolean allowEmpty()
protected java.lang.String stringKey(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key)
args
- Argumentskey
- Argument name
protected java.lang.Integer integerKey(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key)
args
- Argumentskey
- Argument name
protected java.lang.Double floatKey(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key)
args
- Argumentskey
- Argument name
protected java.lang.Boolean booleanKey(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key)
args
- Argumentskey
- Argument name
protected java.util.Date dateKey(java.util.Map<java.lang.String,java.lang.Object> args, java.lang.String key, java.text.DateFormat format) throws java.lang.IllegalArgumentException
args
- Argumentskey
- Argument nameformat
- Date format
java.lang.IllegalArgumentException
- If the date is invalidpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |