edu.vt.middleware.password.UppercaseCharacterRule 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 uppercase
* characters.
*
* @author Middleware Services
* @version $Revision: 1636 $ $Date: 2010-10-04 11:12:15 -0400 (Mon, 04 Oct 2010) $
*/
public class UppercaseCharacterRule extends AbstractCharacterRule
{
/** Character type. */
private static final String CHARACTER_TYPE = "uppercase";
/** Default constructor. */
public UppercaseCharacterRule() {}
/**
* Create a new uppercase character rule.
*
* @param num number of uppercase characters to enforce
*/
public UppercaseCharacterRule(final int num)
{
setNumberOfCharacters(num);
}
/** {@inheritDoc} */
@Override
public String getValidCharacters()
{
return "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
/** {@inheritDoc} */
@Override
protected int getNumberOfCharacterType(final Password password)
{
return password.getNumberOfUppercase();
}
/** {@inheritDoc} */
@Override
protected String getCharacterType()
{
return CHARACTER_TYPE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy