Details

    • Estimated Difficulty:
      Low
    • Similar Issues:
      Show 10 results 

      Description

      An extremely common use case for the "toString" methods on Archive are to print the contents of the Archive to stdout.

      System.out.println(archive.toString(true));

      Having to wrap the call in System.out.println is really annoying (even with editor shortcuts). ShrinkWrap should provide parallel print methods, that print to stdout (or perhaps to an optional stream argument).

      archive.print()
      archive.print(true)
      archive.print(Formatter)

      • parallel methods that accept a stream if warranted
      • I'd also settle for printArchive()

      This feature is consistent with the ever popular Exception#printStackTrace().

      UPDATE: See comment about writeTo() proposal.

        Gliffy Diagrams

          Activity

          Hide
          alrubinger Andrew Rubinger added a comment -

          I always thought Exception.prinkStackTrace was a bad idea. Reason being: Streams write things. Things don't write themselves. I'd like to discuss this one a bit.

          Also, usually System.out is an odd default target; usually it's a logger, not some stream directly.

          Show
          alrubinger Andrew Rubinger added a comment - I always thought Exception.prinkStackTrace was a bad idea. Reason being: Streams write things. Things don't write themselves. I'd like to discuss this one a bit. Also, usually System.out is an odd default target; usually it's a logger, not some stream directly.
          Hide
          alrubinger Andrew Rubinger added a comment -

          Unscheduling

          Show
          alrubinger Andrew Rubinger added a comment - Unscheduling
          Hide
          ljnelson Laird Nelson added a comment -

          Compromise: Make Archive implement Formattable directly?

          Show
          ljnelson Laird Nelson added a comment - Compromise: Make Archive implement Formattable directly?
          Show
          alrubinger Andrew Rubinger added a comment - Laird: You mean: http://docs.jboss.org/shrinkwrap/1.0.0-alpha-12/org/jboss/shrinkwrap/api/Archive.html#toString(org.jboss.shrinkwrap.api.formatter.Formatter ) ?
          Hide
          ljnelson Laird Nelson added a comment -

          Duh; yes.

          Show
          ljnelson Laird Nelson added a comment - Duh; yes.
          Hide
          alrubinger Andrew Rubinger added a comment -

          For reasons noted in the comments, rejecting. Sorry, Dan. Reopen with new arguments if you feel strongly about it and we'll revisit the debate.

          Show
          alrubinger Andrew Rubinger added a comment - For reasons noted in the comments, rejecting. Sorry, Dan. Reopen with new arguments if you feel strongly about it and we'll revisit the debate.
          Hide
          dan.j.allen Dan Allen added a comment -

          Upon further review, we've got a new proposal. I still feel that the System.out.println() breaks the spirit of ShrinkWrap's fluid API. So instead, let's think about a more general purpose for these methods.

          What we really want to do is write to a stream. So, how about this API

          writeTo(Stream, Formatter)

          Then we can do something like:

          archive.writeTo(System.out, Formatter.VERBOSE)

          This is more in spirit with the zip exporters where we are pushing the archive through to a stream in some way. We are exporting the view of the archive in essence.

          Show
          dan.j.allen Dan Allen added a comment - Upon further review, we've got a new proposal. I still feel that the System.out.println() breaks the spirit of ShrinkWrap's fluid API. So instead, let's think about a more general purpose for these methods. What we really want to do is write to a stream. So, how about this API writeTo(Stream, Formatter) Then we can do something like: archive.writeTo(System.out, Formatter.VERBOSE) This is more in spirit with the zip exporters where we are pushing the archive through to a stream in some way. We are exporting the view of the archive in essence.
          Hide
          alrubinger Andrew Rubinger added a comment -

          Volunteered to be tackled by Tommy Tynjä (@tommysdk)

          Show
          alrubinger Andrew Rubinger added a comment - Volunteered to be tackled by Tommy Tynjä (@tommysdk)
          Hide
          tommysdk Tommy Tynjä added a comment -
          Show
          tommysdk Tommy Tynjä added a comment - Committed implementation to: https://github.com/tommysdk/shrinkwrap/tree/SHRINKWRAP-235
          Show
          alrubinger Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/shrinkwrap/commit/3117930134abd282f4784ae1019961c00e62170a https://github.com/shrinkwrap/shrinkwrap/commit/37420fd2b936bdcd51d1a2e6e017dec8b7275707 https://github.com/shrinkwrap/shrinkwrap/commit/cac9ad79720a68c72148dba2d14ad1cc7a68c536

            People

            • Assignee:
              tommysdk Tommy Tynjä
              Reporter:
              dan.j.allen Dan Allen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development