Package org.apache.wiki.pages
Class PageSorter
java.lang.Object
org.apache.wiki.pages.PageSorter
- All Implemented Interfaces:
Comparator<String>
Wrapper class for managing and using the PageNameComparator.
Note - this class is deliberately not null safe. Never call any of the methods with a null argument!
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor uses Java "natural" ordering.PageSorter(Comparator<String> comparator) Construct with a particular comparator. -
Method Summary
Modifier and TypeMethodDescriptionintCompare two page names (String version).booleanvoidinitialize(Properties props) Called by Engine to initialise this instance.voidSorts the specified array into ascending order based on the PageNameComparator.voidSorts the specified list into ascending order based on the PageNameComparator.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
PROP_PAGE_NAME_COMPARATOR
- See Also:
-
-
Constructor Details
-
PageSorter
public PageSorter()Default constructor uses Java "natural" ordering. -
PageSorter
Construct with a particular comparator.- Parameters:
comparator- the Comparator to use
-
-
Method Details
-
compare
Compare two page names (String version).- Specified by:
comparein interfaceComparator<String>- Parameters:
pageName1- the first page namepageName2- the second page name- Returns:
- see java.util.Comparator
- See Also:
-
equals
- Specified by:
equalsin interfaceComparator<String>- Overrides:
equalsin classObject
-
initialize
Called by Engine to initialise this instance. Tries to use class given by the PROP_PAGE_NAME_COMPARATOR property as the page name comparator. Uses a default comparator if this property is not set or there is any problem loading the specified class.- Parameters:
props- this Engine's properties.
-
sort
Sorts the specified list into ascending order based on the PageNameComparator. The actual sort is done usingList.sort().- Parameters:
nameList- the page names to be sorted
-
sort
Sorts the specified array into ascending order based on the PageNameComparator. The actual sort is done usingArrays.sort().- Parameters:
nameArray- the page names to be sorted
-