edu.vt.middleware.password
Class LengthRule

java.lang.Object
  extended by edu.vt.middleware.password.LengthRule
All Implemented Interfaces:
Rule

public class LengthRule
extends java.lang.Object
implements Rule

LengthRule contains methods for determining if a password is within a desired length. The minimum and maximum lengths are used inclusively to determine if a password meets this rule.

Version:
$Revision: 1841 $ $Date: 2011-02-25 14:05:47 -0500 (Fri, 25 Feb 2011) $
Author:
Middleware Services

Constructor Summary
LengthRule()
          This will create a new LengthRule with lengths unset.
LengthRule(int length)
          This will create a new LengthRule with the supplied length.
LengthRule(int minLength, int maxLength)
          This will create a new LengthRule with the supplied lengths.
 
Method Summary
 int getMaximumLength()
          Get the maximum password length.
 int getMinimumLength()
          Get the minimum password length.
 void setMaximumLength(int maxLength)
          Set the maximum password length.
 void setMinimumLength(int minLength)
          Set the minimum password length.
 java.lang.String toString()
          This returns a string representation of this object.
 RuleResult validate(PasswordData passwordData)
          This returns whether or not the supplied password data meets the requirements of this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LengthRule

public LengthRule()
This will create a new LengthRule with lengths unset. The defaults are 0 and Integer.MAX_VALUE respectively.


LengthRule

public LengthRule(int length)
This will create a new LengthRule with the supplied length. Both the minimum and the maximum length will be set to this value.

Parameters:
length - int length of password

LengthRule

public LengthRule(int minLength,
                  int maxLength)
This will create a new LengthRule with the supplied lengths.

Parameters:
minLength - int minimum length of a password
maxLength - int maximum length of a password
Method Detail

setMinimumLength

public void setMinimumLength(int minLength)
Set the minimum password length.

Parameters:
minLength - int minimum length of a password

getMinimumLength

public int getMinimumLength()
Get the minimum password length.

Returns:
int

setMaximumLength

public void setMaximumLength(int maxLength)
Set the maximum password length.

Parameters:
maxLength - int maximum length of a password

getMaximumLength

public int getMaximumLength()
Get the maximum password length.

Returns:
int

validate

public RuleResult validate(PasswordData passwordData)
This returns whether or not the supplied password data meets the requirements of this rule.

Specified by:
validate in interface Rule
Parameters:
passwordData - PasswordData to verify (not null).
Returns:
RuleResult - details on password verification

toString

public java.lang.String toString()
This returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.