Class BooleanResult

  • All Implemented Interfaces:
    Serializable

    public final class BooleanResult
    extends Object
    implements Serializable
    Utility class to store a boolean result and a message to explain the reason why the result is either true, false or undetermined (null). The message may be used, for instance, as a resource bundle key in which clients use it to supply details about any operations performed.
    Author:
    Paulo Zenida - Linkare TI
    See Also:
    Serialized Form
    • Field Detail

      • result

        private final Boolean result
        The result of the boolean result type is immutable. Once created, it should not be possible to change it. This means a true result, for instance, will always be a true result.
      • message

        private String message
        The details message associated to this boolean result type. It should not be final to enable the possibility for this type's clients to add a details message associated to the result of the evaluation in which this type was used.
      • TRUE_RESULT

        public static final BooleanResult TRUE_RESULT
        Utility constant to represent the true result without any detail message
      • FALSE_RESULT

        public static final BooleanResult FALSE_RESULT
        Utility constant to represent the false result without any detail message
      • UNDETERMINED_RESULT

        public static final BooleanResult UNDETERMINED_RESULT
        Utility constant to represent the undetermined result without any detail message
    • Constructor Detail

      • BooleanResult

        private BooleanResult​(Boolean result)
        This constructor is private to "force" the client code from this class to use the constants.
        Parameters:
        result - the result to set.
      • BooleanResult

        public BooleanResult​(Boolean result,
                             String message)
        Parameters:
        result - the result to set.
        message - the message to set.
    • Method Detail

      • getResult

        public Boolean getResult()
        Returns:
        the result
      • getMessage

        public String getMessage()
        Returns:
        the message
      • setMessage

        public BooleanResult setMessage​(String message)
        Parameters:
        message - the message to set
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object