Package com.jk.core.validation
Class Problems
java.lang.Object
com.jk.core.validation.Problems
This class represents a collection of problems or issues, each associated
with a severity level.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
This method adds a problem with the specified severity level to the collection.final void
This method adds a problem with a default severity level of "FATAL" to the collection.final void
This method adds a problem with the specified severity level to the collection.final Problem
This method retrieves the problem with the highest severity level from the collection.This method retrieves the list of problems stored in this collection.final boolean
hasFatal()
This method checks if any problem in the collection has a severity level of "FATAL".final boolean
isEmpty()
This method checks if the collection is empty (contains no problems).final void
This method adds all problems from another Problems collection to this collection.This method appends the messages of all problems in the collection to a multi-line string.toString()
Returns a string representation of the object.
-
Constructor Details
-
Problems
public Problems()
-
-
Method Details
-
add
This method adds a problem with the specified severity level to the collection.- Parameters:
problem
- Specifies the problem to add.
-
add
This method adds a problem with a default severity level of "FATAL" to the collection.- Parameters:
problem
- the problem
-
add
This method adds a problem with the specified severity level to the collection.- Parameters:
problem
- Specifies the problem message to add.severity
- Specifies the severity level of the problem.
-
getLeadProblem
This method retrieves the problem with the highest severity level from the collection.- Returns:
- the problem with the highest severity level, or null if the collection is empty.
-
getProblemsList
This method retrieves the list of problems stored in this collection.- Returns:
- the list of problems.
-
hasFatal
public final boolean hasFatal()This method checks if any problem in the collection has a severity level of "FATAL".- Returns:
- true, if at least one problem has severity "FATAL," otherwise false.
-
isEmpty
public final boolean isEmpty()This method checks if the collection is empty (contains no problems).- Returns:
- true, if the collection is empty, otherwise false.
-
putAll
This method adds all problems from another Problems collection to this collection.- Parameters:
problems
- Specifies the Problems collection from which to add problems.
-
toMutilLineString
This method appends the messages of all problems in the collection to a multi-line string.- Returns:
- a string containing each problem message on a separate line.
-
toString
Returns a string representation of the object.
-