org.passay.RuleResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of passay Show documentation
Show all versions of passay Show documentation
Library for checking that a password complies with a custom set of rules
/* See LICENSE for licensing and NOTICE for copyright. */
package org.passay;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Result of a password rule validation.
*
* @author Middleware Services
*/
public class RuleResult
{
/** Whether password rule was successful. */
protected boolean valid;
/** Details associated with a password rule result. */
protected List details = new ArrayList<>();
/** Default constructor. */
public RuleResult() {}
/**
* Creates a new rule result.
*
* @param b result validity
*/
public RuleResult(final boolean b)
{
setValid(b);
}
/**
* Creates a new rule result.
*
* @param b result validity
* @param rrd details associated with this result
*/
public RuleResult(final boolean b, final RuleResultDetail rrd)
{
setValid(b);
details.add(rrd);
}
/**
* Returns whether the result of the rule verification is a valid password.
*
* @return valid password for this rule
*/
public boolean isValid()
{
return valid;
}
/**
* Sets whether the result of the rule verification is a valid password.
*
* @param b valid password for this rule
*/
public void setValid(final boolean b)
{
valid = b;
}
/**
* Returns any details associated with the rule verification.
*
* @return rule result details
*/
public List getDetails()
{
return details;
}
/**
* Sets any details associated with the rule verification.
*
* @param rrd rule result details
*/
public void setDetails(final RuleResultDetail... rrd)
{
setDetails(Arrays.asList(rrd));
}
/**
* Sets any details associated with the rule verification.
*
* @param rrd rule result details
*/
public void setDetails(final List rrd)
{
details = rrd;
}
@Override
public String toString()
{
return String.format("%s@%h::valid=%s,details=%s", getClass().getName(), hashCode(), valid, details);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy