Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-18554

ChildPositionComparator deprecated without alternative

    XMLWordPrintable

Details

    Description

      The class com.atlassian.confluence.pages.ChildPositionComparator. Here is the simple code:

      /**
       * @deprecated since 2.9 use Page.CHILD_POSITION_COMPARATOR
       * A comparator used to sort pages based on the Page Ordering sort rules.
       * <p/>
       * This comparator will compare the position of the two pages with <code>null</code>
       * smaller than anything else. If that comparison results in 0 a title based
       * "natural" sort will be used. For details on the Natural Sort algorithm
       * see the {@link com.atlassian.confluence.pages.NaturalStringComparator}.
       */
      public class ChildPositionComparator implements Comparator<Page>
      {
          public int compare(Page page0, Page page1)
          {
              return Page.CHILD_PAGE_COMPARATOR.compare(page0, page1);
          }
      }
      

      Unfortunately Page.CHILD_PAGE_COMPARATOR is package local final, so we cant use that. In addition, this comparator class itself is an private static inner class of Page. I recommend making the variable public, or providing a recommendation on how to get a child page comparator for use in plugins without requiring to use packaging hacks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dhardiker Dan Hardiker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: