Class ConvenientNamedList


  • public class ConvenientNamedList
    extends Object
    Provides more convenient read-only access to the elements of a NamedList. The getNested methods of this class return a nested named list, wrapped in another instance of this class. If the nested list does not exist or the element at the given name or index is null, the returned ConvenientNamedList is empty. All other getter methods return null if the underlying named list does not contain a value for a given name, or if the value for the given name is null. The underlying named list may itself be null, in this case, the methods will also return null.
    • Constructor Detail

      • ConvenientNamedList

        public ConvenientNamedList​(org.apache.solr.common.util.NamedList namedList)
        Creates a new read-only wrapper for the given named list.
    • Method Detail

      • size

        public int size()
        Returns the size of the underlying named list.
      • getNested

        public ConvenientNamedList getNested​(int index)
        Returns the nested NamedList at the given index, or returns an empty ConvenientNamedList if the given index is invalid in the underlying list.
      • getSet

        public <T> Set<T> getSet​(String name)
        Returns the set of the given name.
        Type Parameters:
        T - the type of the elements in the set. This is not checked by this method. If any elements in the set are not of the expected type, accessing the elements of the set will result in a ClassCastException.
      • getList

        public <T> List<T> getList​(String name)
        Returns the list of the given name.
        Type Parameters:
        T - the type of the elements in the list. This is not checked by this method. If any elements in the list are not of the expected type, accessing the elements of the list will result in a ClassCastException.
      • getCollection

        public <T> Collection<T> getCollection​(String name)
        Returns the collection of the given name.
        Type Parameters:
        T - the type of the elements in the set. This is not checked by this method. If any elements in the set are not of the expected type, accessing the elements of the set will result in a ClassCastException.
      • getString

        public String getString​(String name)
        Returns the string of the given name.
      • getNamedList

        public org.apache.solr.common.util.NamedList<?> getNamedList()
        Returns the underlying NamedList.