Package net.sf.basedb.util.overview
Class Failure
- java.lang.Object
-
- net.sf.basedb.util.overview.Failure
-
public class Failure extends Object
Holds information about a failed validation. Note that all rules are always validated. Use aValidationOptions
object to keep track of which validators that should be ignored, generate warnings or errors.NOTE! The implementation of the
equals(Object)
method of this object is a bit unorthodox. Two failures are considered equal if they have the same validator but different nodes referencing the same item with the same descriptor. Two failures on the same node are never equal. This allows us to filter out duplicate failures that happens because there can be several ways to reach a certain item (for example a reference sample that is used on all hybridizations).- Version:
- 2.2
- Author:
- Nicklas
- See Also:
Validator
,ValidationOptions
,GenericOverview.getFailures()
,GenericOverview.getValidationOptions()
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
-
Constructor Summary
Constructors Constructor Description Failure(ValidationRuleAction rule, Node node)
Create a new validation failure.Failure(ValidationRuleAction rule, Node node, String message)
Create a new validation failure with a detailed message.Failure(ValidationRuleAction rule, Node node, String message, Fix... fixes)
Create a new validation failure with a detailed message and a list of suggested fixes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFix(Fix fix)
Add a suggested fix to this failure.boolean
equals(Object o)
One failure is the same as another if they have the same validator but different nodes referencing the same item with equal descriptors.Object
getDescriptor()
List<Fix>
getFixes()
Get a list of suggested fixes.String
getMessage()
Get a message explaining the failure.Node
getNode()
Get the node that failed validation.ValidationRuleAction
getValidator()
Get the validation rule that failed.int
hashCode()
void
setDescriptor(Object descriptor)
Set a descriptor on this failure.String
toString()
-
-
-
Constructor Detail
-
Failure
public Failure(ValidationRuleAction rule, Node node)
Create a new validation failure.- Parameters:
rule
- The validation rule that failsnode
- The node that contains the failure
-
Failure
public Failure(ValidationRuleAction rule, Node node, String message)
Create a new validation failure with a detailed message.- Parameters:
rule
- The validation rule that failsnode
- The node that contains the failuremessage
- A detailed message about the failue, if null theValidator.getFailureSummary()
is used
-
Failure
public Failure(ValidationRuleAction rule, Node node, String message, Fix... fixes)
Create a new validation failure with a detailed message and a list of suggested fixes.- Parameters:
rule
- The validation rule that failsnode
- The node that contains the failuremessage
- A detailed message about the failue, if null theValidator.getFailureSummary()
is usedfixes
- A list of suggested fixes
-
-
Method Detail
-
setDescriptor
public void setDescriptor(Object descriptor)
Set a descriptor on this failure. This affects theequals(Object)
method, since the descriptor must be equal for two failures to be equal.NOTE! The main reason for this property is that we need to discriminate between failures on different positions on physical bioassays.
- Parameters:
descriptor
- Any object- Since:
- 2.6
-
getDescriptor
public Object getDescriptor()
- Returns:
- The descriptor
- Since:
- 2.6
- See Also:
setDescriptor(Object)
-
getValidator
public ValidationRuleAction getValidator()
Get the validation rule that failed.- Since:
- 3.2
-
getNode
public Node getNode()
Get the node that failed validation.
-
getMessage
public String getMessage()
Get a message explaining the failure.
-
getFixes
public List<Fix> getFixes()
Get a list of suggested fixes.- Returns:
- A list of suggested fixes, or null if there are none
-
addFix
public void addFix(Fix fix)
Add a suggested fix to this failure.- Parameters:
fix
- The fix to add.
-
equals
public boolean equals(Object o)
One failure is the same as another if they have the same validator but different nodes referencing the same item with equal descriptors.
-
-