Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-310

FTPCommand conversion to use enum

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.3
    • FTP
    • None

    Description

      Seems to me it would be sensible to replace the integer values in the FTPCommand class with an enum.

      I propose creating a new enum class (called FTPCommands) which contains the enum and aliases. The existing FTPCommand class is then rewritten using the enum ordinals; and the FTP class is changed to use the enums internally. Existing public methods which use an integer for the command id are deprecated.

      If there are any further commands added to the set lter, they should only be added to the enum, and no corresponding ints should be defined.

      See attached patch (to follow). I've not fixed the FTP subclasses yet as I wanted to get agreement on the approach first.

      Note that the new class name FTPCommands is very similar to the old class FTPCommand; of course that can be changed.

      Comments? Suggestions?

      Attachments

        1. FTPCommandEnum.patch
          24 kB
          Sebb
        2. FTPCmd.patch
          30 kB
          Sebb

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: