Package org.passay
Class RuleResult
- java.lang.Object
-
- org.passay.RuleResult
-
public class RuleResult extends Object
Result of a password rule validation.- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description protected List<RuleResultDetail>
details
Details associated with a password rule result.protected RuleResultMetadata
metadata
Metadata produced by a password rule.protected boolean
valid
Whether password rule was successful.
-
Constructor Summary
Constructors Constructor Description RuleResult()
Creates a new rule result with its validity set to true.RuleResult(boolean b)
Creates a new rule result.RuleResult(boolean b, RuleResultDetail rrd)
Creates a new rule result.RuleResult(boolean b, RuleResultDetail rrd, RuleResultMetadata rrm)
Creates a new rule result.RuleResult(boolean b, RuleResultMetadata rrm)
Creates a new rule result.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(String[] codes, Map<String,Object> params)
Adds a new rule result detail under multiple error codes.void
addError(String code, Map<String,Object> params)
Adds a new rule result detail with the given error details and sets the result of the rule verification to invalid.List<RuleResultDetail>
getDetails()
Returns any details associated with the rule verification.RuleResultMetadata
getMetadata()
Returns metadata associated with the rule verification.boolean
isValid()
Returns whether the result of the rule verification is a valid password.void
setDetails(List<RuleResultDetail> rrd)
Sets any details associated with the rule verification.void
setDetails(RuleResultDetail... rrd)
Sets any details associated with the rule verification.void
setMetadata(RuleResultMetadata rrm)
Sets metadata associated with the rule verification.void
setValid(boolean b)
Sets whether the result of the rule verification is a valid password.String
toString()
-
-
-
Field Detail
-
valid
protected boolean valid
Whether password rule was successful.
-
details
protected List<RuleResultDetail> details
Details associated with a password rule result.
-
metadata
protected RuleResultMetadata metadata
Metadata produced by a password rule.
-
-
Constructor Detail
-
RuleResult
public RuleResult()
Creates a new rule result with its validity set to true.
-
RuleResult
public RuleResult(boolean b)
Creates a new rule result.- Parameters:
b
- result validity
-
RuleResult
public RuleResult(boolean b, RuleResultDetail rrd)
Creates a new rule result.- Parameters:
b
- result validityrrd
- details associated with this result
-
RuleResult
public RuleResult(boolean b, RuleResultMetadata rrm)
Creates a new rule result.- Parameters:
b
- result validityrrm
- metadata associated by the rule with the password
-
RuleResult
public RuleResult(boolean b, RuleResultDetail rrd, RuleResultMetadata rrm)
Creates a new rule result.- Parameters:
b
- result validityrrd
- details associated with this resultrrm
- metadata associated by the rule with the password
-
-
Method Detail
-
isValid
public boolean isValid()
Returns whether the result of the rule verification is a valid password.- Returns:
- valid password for this rule
-
setValid
public void setValid(boolean b)
Sets whether the result of the rule verification is a valid password.- Parameters:
b
- valid password for this rule
-
getDetails
public List<RuleResultDetail> getDetails()
Returns any details associated with the rule verification.- Returns:
- rule result details
-
addError
public void addError(String code, Map<String,Object> params)
Adds a new rule result detail with the given error details and sets the result of the rule verification to invalid.- Parameters:
code
- error codeparams
- error details
-
addError
public void addError(String[] codes, Map<String,Object> params)
Adds a new rule result detail under multiple error codes.- Parameters:
codes
- error codes in order of most specific to least specificparams
- error details
-
setDetails
public void setDetails(RuleResultDetail... rrd)
Sets any details associated with the rule verification.- Parameters:
rrd
- rule result details
-
setDetails
public void setDetails(List<RuleResultDetail> rrd)
Sets any details associated with the rule verification.- Parameters:
rrd
- rule result details
-
getMetadata
public RuleResultMetadata getMetadata()
Returns metadata associated with the rule verification.- Returns:
- rule result metadata
-
setMetadata
public void setMetadata(RuleResultMetadata rrm)
Sets metadata associated with the rule verification.- Parameters:
rrm
- rule result metadata
-
-