Enum CommentHandlers

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static @Nullable java.lang.String extractComment​(java.io.BufferedReader reader, java.lang.Iterable<CommentHandler> allowedHeaderTypes)
      Uses provided comment handlers to extract a comment from the reader.
      @Nullable java.lang.String extractHeader​(java.io.BufferedReader reader)
      Defines the handlers behaviour for reading comments.
      java.util.stream.Stream<java.lang.String> toComment​(java.util.stream.Stream<java.lang.String> lines)
      Converts the specified lines into a comment.
      static CommentHandlers valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CommentHandlers[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static CommentHandlers[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CommentHandlers c : CommentHandlers.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CommentHandlers valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • extractHeader

        public @Nullable java.lang.String extractHeader​(java.io.BufferedReader reader)
                                                 throws java.io.IOException
        Description copied from interface: CommentHandler
        Defines the handlers behaviour for reading comments.
        Specified by:
        extractHeader in interface CommentHandler
        Parameters:
        reader - reader to get input from
        Returns:
        an extracted comment, if any
        Throws:
        java.io.IOException - if any IO error occurs in the process
      • toComment

        public java.util.stream.Stream<java.lang.String> toComment​(java.util.stream.Stream<java.lang.String> lines)
        Description copied from interface: CommentHandler
        Converts the specified lines into a comment.
        Specified by:
        toComment in interface CommentHandler
        Parameters:
        lines - lines to make a comment
        Returns:
        transformed lines as a stream
      • extractComment

        public static @Nullable java.lang.String extractComment​(java.io.BufferedReader reader,
                                                                java.lang.Iterable<CommentHandler> allowedHeaderTypes)
                                                         throws java.io.IOException
        Uses provided comment handlers to extract a comment from the reader.
        Parameters:
        reader - to extract a comment from
        allowedHeaderTypes - handlers to try
        Returns:
        extracted comment, or null if a comment could not be extracted
        Throws:
        java.io.IOException - if an IO error occurs
        Since:
        4.0.0