Package hudson.util
Class DescribableList<T extends Describable<T>,D extends Descriptor<T>>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
hudson.util.PersistedList<T>
hudson.util.DescribableList<T,D>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>
- Direct Known Subclasses:
Jenkins.CloudList,View.PropertyList
public class DescribableList<T extends Describable<T>,D extends Descriptor<T>>
extends PersistedList<T>
Persisted list of
Describables with some operations specific
to Descriptors.
This class allows multiple instances of the same descriptor. Some clients
use this semantics, while other clients use it as "up to one instance per
one descriptor" model.
Some of the methods defined in this class only makes sense in the latter model,
such as remove(Descriptor).
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConverterimplementation for XStream.static interfaceDeprecated.since 2008-08-15. -
Field Summary
Fields inherited from class hudson.util.PersistedList
data, ownerFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDescribableList(Saveable owner) DescribableList(Saveable owner, Collection<? extends T> initialList) Deprecated.since 2008-08-15. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildDependencyGraph(AbstractProject owner, DependencyGraph graph) Picks upDependencyDeclarers and allow it to build dependencies.boolean<U extends T>
UgetDynamic(String id) Binds items in the collection to URL.voidrebuild(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors) Rebuilds the list by creating a fresh instances from the submitted form.voidrebuild(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors) Deprecated.voidrebuild(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors, String prefix) Deprecated.as of 1.271 Userebuild(StaplerRequest2, JSONObject, List)instead.voidrebuildHetero(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData, Collection<? extends Descriptor<T>> descriptors, String key) Rebuilds the list by creating a fresh instances from the submitted form.voidrebuildHetero(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData, Collection<? extends Descriptor<T>> descriptors, String key) Deprecated.voidvoidRemoves all instances of the same type, then add the new one.voidsetOwner(DescribableList.Owner owner) Deprecated.since 2008-08-15.T[]toMap()Creates a detached map from the current snapshot of the data, keyed from a descriptor to an instance.Methods inherited from class hudson.util.PersistedList
add, addAll, addAllTo, clear, contains, get, getAll, isEmpty, iterator, onModified, remove, remove, removeAll, replace, replaceBy, setOwner, size, toArray, toList, toStringMethods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray
-
Constructor Details
-
DescribableList
protected DescribableList() -
DescribableList
Deprecated.since 2008-08-15. UseDescribableList(Saveable) -
DescribableList
-
DescribableList
-
-
Method Details
-
setOwner
Deprecated.since 2008-08-15. UsePersistedList.setOwner(Saveable) -
replace
Removes all instances of the same type, then add the new one.- Throws:
IOException
-
getDynamic
Binds items in the collection to URL. -
get
-
contains
-
remove
- Throws:
IOException
-
toMap
Creates a detached map from the current snapshot of the data, keyed from a descriptor to an instance. -
rebuild
public void rebuild(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors) throws Descriptor.FormException, IOException Rebuilds the list by creating a fresh instances from the submitted form.This method is almost always used by the owner. This method does not invoke the save method.
- Parameters:
json- Structured form data that includes the data for nested descriptor list.- Throws:
Descriptor.FormExceptionIOException
-
rebuild
@Deprecated public void rebuild(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors) throws Descriptor.FormException, IOException Deprecated.- Throws:
Descriptor.FormExceptionIOException
-
rebuild
@Deprecated public void rebuild(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json, List<? extends Descriptor<T>> descriptors, String prefix) throws Descriptor.FormException, IOException Deprecated.as of 1.271 Userebuild(StaplerRequest2, JSONObject, List)instead.- Throws:
Descriptor.FormExceptionIOException
-
rebuildHetero
public void rebuildHetero(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject formData, Collection<? extends Descriptor<T>> descriptors, String key) throws Descriptor.FormException, IOException Rebuilds the list by creating a fresh instances from the submitted form.This version works with the
<f:hetero-list>UI tag, where the user is allowed to create multiple instances of the same descriptor. Order is also significant.- Throws:
Descriptor.FormExceptionIOException
-
rebuildHetero
@Deprecated public void rebuildHetero(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData, Collection<? extends Descriptor<T>> descriptors, String key) throws Descriptor.FormException, IOException Deprecated.- Throws:
Descriptor.FormExceptionIOException
-
buildDependencyGraph
Picks upDependencyDeclarers and allow it to build dependencies. -
get
- Overrides:
getin classPersistedList<T extends Describable<T>>
-
toArray
-