Package com.iizix.prop
Class PropError
- java.lang.Object
- com.iizix.prop.PropError
- All Implemented Interfaces:
java.lang.Cloneable
public class PropError extends java.lang.Object implements java.lang.Cloneable
Class used to hold errors for a property.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description static IPropErrorItem[]
EMPTY
An empty array.
Constructor Summary
Constructors Constructor Description PropError(IPropErrorItem item)
Creates a new instance of the errors property initialized with one errors item.PropError(IPropErrorItem[] items)
Creates a new instance of the errors property initialized with one errors item.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
assign(PropVerificationError[] verifyErrors)
Assigns the verification errors.PropError
clone()
Clones this instance.boolean
equals(PropError pe, java.lang.String... ignoredIDs)
Verification of equality, except the specified the specified ID's.boolean
equals(java.lang.Object o)
Checks if two PropError's are equal, i.e.IPropErrorItem
get(java.lang.String id)
Gets the error input item with specified ID, for none specify empty string.IPropErrorItem[]
getAll()
Gets all the errors in an array.int
getSeverity()
Gets the maximum severity of this property error instance.boolean
isEmpty()
Checks if the error items are empty.java.lang.String
toString()
Formats the error input to a string.
Field Detail
EMPTY
public static IPropErrorItem[] EMPTY
An empty array.
Constructor Detail
PropError
public PropError(IPropErrorItem item)
Creates a new instance of the errors property initialized with one errors item.- Parameters:
item
- An input error item.- Throws:
java.lang.NullPointerException
- If input or message is null.
PropError
public PropError(IPropErrorItem[] items)
Creates a new instance of the errors property initialized with one errors item.- Parameters:
items
- An array of input error items.- Throws:
java.lang.NullPointerException
- If input or message is null.
Method Detail
getSeverity
public int getSeverity()
Gets the maximum severity of this property error instance.- Returns:
- -1 if no errors, otherwise IPropErrorItem.INFO=0, WARNING=1 or ERROR=2.
isEmpty
public boolean isEmpty()
Checks if the error items are empty.
get
public IPropErrorItem get(java.lang.String id)
Gets the error input item with specified ID, for none specify empty string.- Parameters:
id
- The ID for the error, can be empty string (null means default empty string).- Returns:
- The error item for the ID, or null for not found.
getAll
public IPropErrorItem[] getAll()
Gets all the errors in an array.- Returns:
- An array copy of the errors, never null.
assign
public boolean assign(PropVerificationError[] verifyErrors)
Assigns the verification errors.- Parameters:
verifyErrors
- The set of verification errors.- Returns:
- true for changes, false for no change.
toString
public java.lang.String toString()
Formats the error input to a string.- Overrides:
toString
in classjava.lang.Object
clone
public PropError clone()
Clones this instance.- Overrides:
clone
in classjava.lang.Object
equals
public boolean equals(java.lang.Object o)
Checks if two PropError's are equal, i.e. that the errors are all present, ordering doesn't matter.- Overrides:
equals
in classjava.lang.Object
equals
public boolean equals(PropError pe, java.lang.String... ignoredIDs)
Verification of equality, except the specified the specified ID's.- Parameters:
pe
- Compare with this error property.ignoredIDs
- Ignored error IDs.- Returns:
- true if equal, false otherwise.