org.wamblee.security.authentication
Class RegexpNameValidator

java.lang.Object
  extended by org.wamblee.security.authentication.RegexpNameValidator
All Implemented Interfaces:
NameValidator

public class RegexpNameValidator
extends java.lang.Object
implements NameValidator

Validation of names based on a regular expression.

Author:
Erik Brakkee

Field Summary
static java.lang.String ID_PATTERN
          Convenience pattern for an id.
static java.lang.String PASSWORD_PATTERN
          Convenience pattern for a password consisting of at least 6 characters.
 
Constructor Summary
RegexpNameValidator(java.lang.String aPattern, java.lang.String aReason, java.lang.String aMessage)
          Convenience constructor with all string parameters.
RegexpNameValidator(java.lang.String aPattern, UserMgtException.Reason aReason, java.lang.String aMessage)
          Validates a regular expression.
 
Method Summary
 boolean validate(java.lang.String aName)
          Validates a name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PATTERN

public static final java.lang.String ID_PATTERN
Convenience pattern for an id.

See Also:
Constant Field Values

PASSWORD_PATTERN

public static final java.lang.String PASSWORD_PATTERN
Convenience pattern for a password consisting of at least 6 characters.

See Also:
Constant Field Values
Constructor Detail

RegexpNameValidator

public RegexpNameValidator(java.lang.String aPattern,
                           UserMgtException.Reason aReason,
                           java.lang.String aMessage)
Validates a regular expression.

Parameters:
aPattern - Pattern that names must comply to.
aReason - Reason to report when validation fails.
aMessage - Message to report.

RegexpNameValidator

public RegexpNameValidator(java.lang.String aPattern,
                           java.lang.String aReason,
                           java.lang.String aMessage)
Convenience constructor with all string parameters. Useful for configuration in Spring.

Parameters:
aPattern - Pattern to use.
aReason - Reason.
aMessage - Message.
Method Detail

validate

public boolean validate(java.lang.String aName)
Description copied from interface: NameValidator
Validates a name.

Specified by:
validate in interface NameValidator
Parameters:
aName - Name
Returns:
True iff the validationo is ok.


Copyright © 2022. All Rights Reserved.