Class FileProblem

  • All Implemented Interfaces:
    Problem, SourcedProblem


    @Immutable
    public class FileProblem
    extends java.lang.Object
    implements SourcedProblem
    A problem that comes from a known file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FileProblem from​(java.io.File file, java.io.IOException ex)
      Create a file problem from a file object and an I/O exception.
      static FileProblem from​(java.lang.String source, java.io.IOException ex)
      Create a file problem from a file object and an I/O exception.
      static FileProblem from​(java.lang.String filePath, java.lang.String localMessage)
      Create the file problem from the file path and message.
      java.lang.String getSource​()
      A single source of the problem.
      java.lang.String localMessage​()
      A human-consumable message describing the problem.
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • from

        @Nonnull
        public static FileProblem from​(@Nonnull
                                       java.lang.String filePath,
                                       @Nonnull
                                       java.lang.String localMessage)
        Create the file problem from the file path and message.
        Parameters:
        filePath - path to the source that caused the problem. In some cases, this may be something other than a file, such as a URI.
        localMessage - informative user message about the problem.
        Returns:
        the problem instance.
      • from

        @Nonnull
        public static FileProblem from​(@Nonnull
                                       java.io.File file,
                                       @Nonnull
                                       java.io.IOException ex)
        Create a file problem from a file object and an I/O exception.
        Parameters:
        file - source file
        ex - exception generated from the operation.
        Returns:
        the file problem object.
      • from

        @Nonnull
        public static FileProblem from​(@Nonnull
                                       java.lang.String source,
                                       @Nonnull
                                       java.io.IOException ex)
        Create a file problem from a file object and an I/O exception.
        Parameters:
        source - source of the problem
        ex - exception generated from the operation.
        Returns:
        the file problem object.
      • localMessage

        @Nonnull
        public java.lang.String localMessage​()
        Description copied from interface: Problem
        A human-consumable message describing the problem.
        Specified by:
        localMessage in interface Problem
        Returns:
        the message, localized for the end-user.
      • getSource

        @Nonnull
        public java.lang.String getSource​()
        Description copied from interface: SourcedProblem
        A single source of the problem.
        Specified by:
        getSource in interface SourcedProblem
        Returns:
        the source of the problem.
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object