Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4076817

rfe: NdFormat.format doesnt allow determination of all field positions

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.3
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description



      Name: joT67522 Date: 09/04/97


      When using the format method of NdFormat to
      determine the position of a field you
      can only determine the position of one
      field at a time. If you want to know
      the positions of all the fields in the
      format you are forced to call format multiple
      times, once for each position. This can
      be very expensive if the format contains
      a large number of fields such as the
      DateTime format.

      A more efficient way would be to add a format
      method which accepts an array of field positions
      so more than one position can be
      returned for a single call to format.


      For example:

      Date today = new Date();
      DateFormat dateFmt = new SimpleDateFormat();
      StringBuffer fmtBuf = new StringBuffer();

      // Determine year position.
      FieldPosition yearPos = new FieldPosition(DateFormat.YEAR_FIELD);
      dateFmt.format(today, fmtBuf, yearPos);

      fmtBuf.setLength(0); // Clear

      // Determine month position.
      FieldPosition monthPos = new FieldPosition(DateFormat.MONTH_FIELD);
      dateFmt.format(today, fmtBuf, monthPos);

      // And so on for each field position...


      company - Neuron Data , email - holland@neurondata
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aliusunw Alan Liu (Inactive)
              Reporter:
              johsunw Joon Oh (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: