Class ValidationInfo

    • Constructor Detail

      • ValidationInfo

        public ValidationInfo​(boolean valid,
                              @Nullable
                              @Nullable String message)
        Creates a new ValidationInfo. You can also use the valid() or invalid(String) function to create a new info object.
        Parameters:
        valid - true, if the validation process was successful
        message - A detailed message if the validation failed. If the validation was successful the message usually is not necessary.
    • Method Detail

      • valid

        @NotNull
        public static @NotNull ValidationInfo valid()
        Creates a new ValidationInfo which indicates that the validation process was successful: isValid() returns true.
        The message will be null in this case. If you would like to add a message, you can use valid(String) but this is usually not necessary.
        Returns:
        A new ValidationInfo which indicates that the validation process was successful
      • valid

        @NotNull
        public static @NotNull ValidationInfo valid​(@Nullable
                                                    @Nullable String message)
        Creates a new ValidationInfo which indicates that the validation process was successful: isValid() returns true. You also can add a message but this is usually not necessary if a validation was successful.
        Parameters:
        message - A detailed message of the validation process
        Returns:
        A new ValidationInfo which indicates that the validation process was successful
      • invalid

        @NotNull
        public static @NotNull ValidationInfo invalid​(@Nullable
                                                      @Nullable String message)
        Creates a new ValidationInfo which indicates that the validation process was not successful: isValid() returns false.
        In this case you should give a detailed messages what went wrong. It is not mandatory (you can pass null) but it is recommended.
        Parameters:
        message - A detailed message, what went wrong
        Returns:
        A new ValidationInfo which indicates that the validation process was not successful
      • invalid

        @NotNull
        public static @NotNull ValidationInfo invalid​(@NotNull
                                                      @NotNull String messageFormat,
                                                      Object... args)
        Creates a new ValidationInfo which indicates that the validation process was not successful: isValid() returns false.
        In this case you should give a detailed messages what went wrong.
        This function has a built-in formatter which uses String.format(String, Object...)
        Parameters:
        messageFormat - A detailed message, what went wrong
        args - Objects which should replace the placeholder within the message
        Returns:
        A new ValidationInfo which indicates that the validation process was not successful
        See Also:
        String.format(String, Object...)
      • isValid

        public boolean isValid()
        Returns:
        true if the validation was successful. false if the validation failed. If the validation failed, check getMessage()
      • isInvalid

        public boolean isInvalid()
        Returns:
        false if the validation was successful. true if the validation failed. If the validation failed, check getMessage()
      • getMessage

        @Nullable
        public @Nullable String getMessage()
        Returns:
        A detailed message of the validation process. This usually is filled, if the validation failed. If the validation was successful the message can be null.