org.mentawai.rule
Class TimeRule

java.lang.Object
  extended by org.mentawai.rule.LocaleRule
      extended by org.mentawai.rule.TimeRule
All Implemented Interfaces:
Rule

public class TimeRule
extends LocaleRule

Author:
Jocenildo Paraizo

Constructor Summary
TimeRule()
          Creates a rule using the default DateFormat style (SHORT).
TimeRule(int style)
          Creates a rule using the given DateFormat style.
 
Method Summary
 boolean check(String value, Locale locale)
          Check a single input value from this action considering its locale.
static TimeRule getInstance()
           
static TimeRule getInstance(int style)
           
 Map<String,String> getTokens()
          Returns a map with tokens that can be used in the error messages.
 
Methods inherited from class org.mentawai.rule.LocaleRule
check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeRule

public TimeRule()
Creates a rule using the default DateFormat style (SHORT).


TimeRule

public TimeRule(int style)
Creates a rule using the given DateFormat style.

Parameters:
style - The DateFormat style. (Ex: DateFormat.HOUR_OF_DAY0_FIELD, DateFormat.SHORT, etc.)
Method Detail

getInstance

public static TimeRule getInstance()

getInstance

public static TimeRule getInstance(int style)

check

public boolean check(String value,
                     Locale locale)
Description copied from class: LocaleRule
Check a single input value from this action considering its locale. Override this method to implement a locale rule for validation.

Specified by:
check in class LocaleRule
Parameters:
value - The value to validate.
locale - The locale to consider in the validation.
Returns:
true if the validation was successful.

getTokens

public Map<String,String> getTokens()
Description copied from interface: Rule
Returns a map with tokens that can be used in the error messages. The tokens in the error messages will be replaced by the token values in this map.

Specified by:
getTokens in interface Rule
Overrides:
getTokens in class LocaleRule
Returns:
A map with the token values.


Copyright © 2013. All Rights Reserved.