Class PropError

java.lang.Object
com.iizix.prop.PropError
All Implemented Interfaces:
Cloneable

public class PropError extends Object implements Cloneable
Class used to hold errors for a property.
Author:
Christopher Mindus
  • Field Details

    • PROP_ERROR_ID_CIRCULAR_REFERENCE

      public static final String PROP_ERROR_ID_CIRCULAR_REFERENCE
      Property errors with an ID starting with this string are circular reference errors or crossovers into circular references.
      See Also:
    • EMPTY

      public static IPropErrorItem[] EMPTY
      An empty array.
  • Constructor Details

    • 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:
      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:
      NullPointerException - If input or message is null.
  • Method Details

    • 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.
    • hasCircularReferencesError

      public boolean hasCircularReferencesError()
      Checks if there is any presence of a circular reference error.
      Returns:
      true if there is at least one circular reference error, or a crossover to a circular reference, false otherwise.
    • get

      public IPropErrorItem get(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 String toString()
      Formats the error input to a string.
      Overrides:
      toString in class Object
    • clone

      public PropError clone()
      Clones this instance.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Checks if two PropError's are equal, i.e. that the errors are all present, ordering doesn't matter.
      Overrides:
      equals in class Object
    • equals

      public boolean equals(PropError pe, 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.