public class ConvenientNamedList extends Object
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 and Description |
|---|
ConvenientNamedList(org.apache.solr.common.util.NamedList namedList)
Creates a new read-only wrapper for the given named list.
|
| Modifier and Type | Method and Description |
|---|---|
<T> Collection<T> |
getCollection(String name)
Returns the collection of the given name.
|
<T> List<T> |
getList(String name)
Returns the list of the given name.
|
org.apache.solr.common.util.NamedList<?> |
getNamedList()
Returns the underlying
NamedList. |
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. |
ConvenientNamedList |
getNested(String... names)
Returns the nested
NamedList at the given path. |
ConvenientNamedList |
getNested(String name)
Returns the nested
NamedList of the given name. |
<T> Set<T> |
getSet(String name)
Returns the set of the given name.
|
String |
getString(String name)
Returns the string of the given name.
|
int |
size()
Returns the size of the underlying named list.
|
String |
toString() |
public ConvenientNamedList(org.apache.solr.common.util.NamedList namedList)
public int size()
public ConvenientNamedList getNested(String name)
NamedList of the given name.public ConvenientNamedList getNested(String... names)
NamedList at the given path.public ConvenientNamedList getNested(int index)
NamedList at the given index, or returns an empty ConvenientNamedList if the
given index is invalid in the underlying list.public <T> Set<T> getSet(String name)
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.public <T> List<T> getList(String name)
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.public <T> Collection<T> getCollection(String name)
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.public org.apache.solr.common.util.NamedList<?> getNamedList()
NamedList.Copyright © 2020. All rights reserved.