edu.vt.middleware.password.DigitCharacterRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vt-password Show documentation
Show all versions of vt-password Show documentation
Library for checking that a password complies with a custom set of rules
The newest version!
/*
$Id$
Copyright (C) 2003-2013 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: [email protected]
Version: $Revision$
Updated: $Date$
*/
package edu.vt.middleware.password;
/**
* Rule for determining if a password contains the correct number of digit
* characters.
*
* @author Middleware Services
* @version $Revision: 1636 $ $Date: 2010-10-04 11:12:15 -0400 (Mon, 04 Oct 2010) $
*/
public class DigitCharacterRule extends AbstractCharacterRule
{
/** Character type. */
private static final String CHARACTER_TYPE = "digit";
/** Default constructor. */
public DigitCharacterRule() {}
/**
* Create a new digit character rule.
*
* @param num of digit characters to enforce
*/
public DigitCharacterRule(final int num)
{
setNumberOfCharacters(num);
}
/** {@inheritDoc} */
@Override
public String getValidCharacters()
{
return "0123456789";
}
/** {@inheritDoc} */
@Override
protected int getNumberOfCharacterType(final Password password)
{
return password.getNumberOfDigits();
}
/** {@inheritDoc} */
@Override
protected String getCharacterType()
{
return CHARACTER_TYPE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy