Class FieldValidationResult

java.lang.Object
mg.emberframework.core.data.FieldValidationResult

public class FieldValidationResult extends Object
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 Details

    • FieldValidationResult

      public FieldValidationResult()
      Default constructor.
    • FieldValidationResult

      public FieldValidationResult(List<Exception> exceptions, String value)
      Constructs a validation result with a list of exceptions and a value.
      Parameters:
      exceptions - the list of exceptions
      value - 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

      public String getExceptionMessage()
      Retrieves the exception messages with a default newline separator.
      Returns:
      the concatenated exception messages
    • getExceptionMessage

      public String getExceptionMessage(String separator)
      Retrieves the exception messages with a custom separator.
      Parameters:
      separator - the separator to use between messages
      Returns:
      the concatenated exception messages
    • addException

      public void addException(Exception exception)
      Adds an exception to the field's validation result.
      Parameters:
      exception - the exception to add
    • getExceptions

      public List<Exception> getExceptions()
      Gets the list of exceptions.
      Returns:
      the exceptions list
    • setExceptions

      public void setExceptions(List<Exception> exceptions)
      Sets the list of exceptions.
      Parameters:
      exceptions - the exceptions to set
    • getValue

      public String getValue()
      Gets the field's value.
      Returns:
      the value
    • setValue

      public void setValue(String value)
      Sets the field's value.
      Parameters:
      value - the value to set