Class DocumentOrderingWrapper


  • public class DocumentOrderingWrapper
    extends Object
    This class is used by the config system to order faces-config documents found on the classpath or configured explicitly via the jakarta.faces.CONFIG_FILES context init parameter.
    • Constructor Detail

      • DocumentOrderingWrapper

        public DocumentOrderingWrapper​(DocumentInfo document)
        Constructs a new DocumentOrderingWrapper for the specified Document.
        Parameters:
        document - the document info
    • Method Detail

      • getDocument

        public DocumentInfo getDocument()
        Returns:
        the wrapped Document
      • getDocumentId

        public String getDocumentId()
        Returns:
        this Document's ID, if any
      • getBeforeIds

        public String[] getBeforeIds()
        Returns:
        this Document's before IDs, if any
      • getAfterIds

        public String[] getAfterIds()
        Returns:
        this Document's after IDs, if any
      • isBeforeOrdered

        public boolean isBeforeOrdered()
        Returns:
        true if any before IDs are present, otherwise false
      • isAfterOrdered

        public boolean isAfterOrdered()
        Returns:
        true if any after IDs are present, otherwise, false
      • isOrdered

        public boolean isOrdered()
        Returns:
        true if this document has any before or after IDs, otherwise false
      • isBefore

        public boolean isBefore​(String id)
        Parameters:
        id - the id to search for
        Returns:
        true if this document is before the specified id, otherwise false
      • isAfter

        public boolean isAfter​(String id)
        Parameters:
        id - the id to search for
        Returns:
        true if this document is after the specified id, otherwise false
      • isAfterOthers

        public boolean isAfterOthers()
        Returns:
        true if this document is after others, otherwise false
      • isBeforeOthers

        public boolean isBeforeOthers()
        Returns:
        true if this document is before others, otherwise false
      • sort

        public static DocumentOrderingWrapper[] sort​(DocumentOrderingWrapper[] documents,
                                                     List<String> absoluteOrder)
        Sort the provided array of Documents per the order specified in the List represented by absoluteOrder.
        Parameters:
        documents - Documents to sort
        absoluteOrder - the absolute order as specified in the /WEB-INF/faces-config.xml
        Returns:
        an array of DocumentOrderingWrappers that may be smaller than the input array of wrappers.
      • sort

        public static void sort​(DocumentOrderingWrapper[] documents)
        Sort the provided array of Documents per the requirements of the 2.0 specification. Note, that this method only provides partial ordering and not absolute ordering.
        Parameters:
        documents - the documents to sort
      • descendingByValue

        public static <K,​V extends Comparable<? super V>> Map<K,​V> descendingByValue​(Map<K,​V> map)