Package mg.emberframework.core.data
Class FieldValidationResult
java.lang.Object
mg.emberframework.core.data.FieldValidationResult
Represents the validation result for a single field.
This class stores a list of exceptions and the field's value, providing methods to check for exceptions and retrieve their messages.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Sandratra NIAINA
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.FieldValidationResult
(List<Exception> exceptions, String value) Constructs a validation result with a list of exceptions and a value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addException
(Exception exception) Adds an exception to the field's validation result.boolean
Checks if the field has any validation exceptions.Retrieves the exception messages with a default newline separator.getExceptionMessage
(String separator) Retrieves the exception messages with a custom separator.Gets the list of exceptions.getValue()
Gets the field's value.void
setExceptions
(List<Exception> exceptions) Sets the list of exceptions.void
Sets the field's value.
-
Constructor Details
-
FieldValidationResult
public FieldValidationResult()Default constructor. -
FieldValidationResult
Constructs a validation result with a list of exceptions and a value.- Parameters:
exceptions
- the list of exceptionsvalue
- the field's value
-
-
Method Details
-
containsException
public boolean containsException()Checks if the field has any validation exceptions.- Returns:
- true if exceptions exist, false otherwise
-
getExceptionMessage
Retrieves the exception messages with a default newline separator.- Returns:
- the concatenated exception messages
-
getExceptionMessage
Retrieves the exception messages with a custom separator.- Parameters:
separator
- the separator to use between messages- Returns:
- the concatenated exception messages
-
addException
Adds an exception to the field's validation result.- Parameters:
exception
- the exception to add
-
getExceptions
Gets the list of exceptions.- Returns:
- the exceptions list
-
setExceptions
Sets the list of exceptions.- Parameters:
exceptions
- the exceptions to set
-
getValue
Gets the field's value.- Returns:
- the value
-
setValue
Sets the field's value.- Parameters:
value
- the value to set
-