T
- The type of members of the collection.public class ResourceCollection<T extends Resource> extends Resource implements java.util.Map<java.lang.String,T>
ResourceCollection
abstract base class represents a collection of
Splunk resources.Modifier and Type | Field and Description |
---|---|
protected java.lang.Class |
itemClass |
protected java.util.LinkedHashMap<java.lang.String,java.util.LinkedList<T>> |
items |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsKey(java.lang.Object key,
Args namespace)
Determines whether a scoped, namespace-constrained key
exists within this collection.
|
boolean |
containsValue(java.lang.Object value) |
protected T |
createItem(AtomEntry entry)
Creates a collection member corresponding to a given
Atom entry.
|
protected T |
createItem(java.lang.Class itemClass,
java.lang.String path,
Args namespace)
Creates a collection member.
|
java.util.Set<java.util.Map.Entry<java.lang.String,T>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
T |
get(java.lang.Object key)
Gets the value of a given key, if it exists within this collection.
|
T |
get(java.lang.Object key,
Args namespace)
Gets a the value of a scoped, namespace-constrained key, if it exists
within this collection.
|
int |
hashCode() |
boolean |
isEmpty() |
protected java.lang.String |
itemKey(AtomEntry entry)
Returns the value to use as the key from a given Atom entry.
|
protected java.lang.String |
itemPath(AtomEntry entry)
Returns the value to use as the member's path from a given Atom entry.
|
java.util.Set<java.lang.String> |
keySet() |
ResponseMessage |
list()
Issues an HTTP request to list the contents of the collection resource.
|
T |
put(java.lang.String key,
T value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends T> map)
Copies all mappings from a given map to this map (unsupported).
|
ResourceCollection |
refresh()
Refreshes the local state of this resource.
|
T |
remove(java.lang.Object key) |
int |
size() |
ResourceCollection<T> |
validate()
Ensures that the local state of the resource is current,
calling
refresh if necessary. |
java.util.Collection<T> |
values() |
int |
valueSize(java.lang.Object key)
Returns the number of values that a specific key represents.
|
getName, getPath, getService, getTitle, getUpdated, invalidate
protected java.util.LinkedHashMap<java.lang.String,java.util.LinkedList<T extends Resource>> items
protected java.lang.Class itemClass
public void clear()
public boolean containsKey(java.lang.Object key)
public boolean containsKey(java.lang.Object key, Args namespace)
key
- The key to look up.namespace
- The namespace to constrain the search to.true
if the key exists, false
if not.public boolean containsValue(java.lang.Object value)
protected T createItem(java.lang.Class itemClass, java.lang.String path, Args namespace)
itemClass
- The class of the member to create.path
- The path to the member resource.namespace
- The namespace.protected T createItem(AtomEntry entry)
ResourceCollection
was created.
Subclasses may override this method to provide alternative means of
instantiating collection members.entry
- The AtomEntry
corresponding to the member to
instantiate.public java.util.Set<java.util.Map.Entry<java.lang.String,T>> entrySet()
public boolean equals(java.lang.Object o)
public T get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,T extends Resource>
key
- The key to look up.null
if it doesn't
exist.SplunkException
- The exception to throw if there is more than one
value represented by this key.public T get(java.lang.Object key, Args namespace)
key
- The key to look up.namespace
- The namespace to constrain the search to.null
if it doesn't
exist.public int hashCode()
public boolean isEmpty()
protected java.lang.String itemKey(AtomEntry entry)
entry
- The AtomEntry
corresponding to the collection
member.protected java.lang.String itemPath(AtomEntry entry)
entry
- The AtomEntry
corresponding to the collection
member.public java.util.Set<java.lang.String> keySet()
public ResponseMessage list()
public void putAll(java.util.Map<? extends java.lang.String,? extends T> map)
public ResourceCollection refresh()
public T remove(java.lang.Object key)
public int size()
public ResourceCollection<T> validate()
refresh
if necessary.public java.util.Collection<T> values()
public int valueSize(java.lang.Object key)
key
- The key to look up.