public final class DescriptorList<T extends Describable<T>> extends AbstractList<Descriptor<T>>
Descriptor
s.
Before Hudson 1.286, this class stored Descriptor
s directly, but since 1.286,
this class works in two modes that are rather different.
One is the compatibility mode, where it works just like pre 1.286 and store everything locally,
disconnected from any of the additions of 1.286. This is necessary for situations where
DescriptorList
is owned by pre-1.286 plugins where this class doesn't know 'T'.
In this mode, legacy
is non-null but type
is null.
The other mode is the new mode, where the Descriptor
s are actually stored in ExtensionList
(see Jenkins.getDescriptorList(Class)
) and this class acts as a view to it. This enables
bi-directional interoperability — both descriptors registered automatically and descriptors registered
manually are visible from both DescriptorList
and ExtensionList
. In this mode,
legacy
is null but type
is non-null.
The number of plugins that define extension points are limited, so we expect to be able to remove
this dual behavior first, then when everyone stops using DescriptorList
, we can remove this class
altogether.
modCount
Constructor and Description |
---|
DescriptorList(Class<T> type)
Creates a
DescriptorList backed by ExtensionList . |
DescriptorList(Descriptor<T>... descriptors)
Deprecated.
As of 1.286. Use
DescriptorList(Class) instead. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Descriptor<T> d)
Deprecated.
As of 1.286. Put
Extension on your descriptor to have it auto-registered,
instead of registering a descriptor manually. |
void |
add(int index,
Descriptor<T> element)
Deprecated.
As of 1.286. Put
Extension on your descriptor to have it auto-registered,
instead of registering a descriptor manually. |
Descriptor<T> |
find(String fqcn)
Deprecated.
Underspecified what the parameter is.
Descriptor.getId() ? A Describable class name? |
Descriptor<T> |
findByName(String id)
Finds a descriptor by their
Descriptor.getId() . |
Descriptor<T> |
get(int index) |
Iterator<Descriptor<T>> |
iterator() |
void |
load(Class<? extends Describable> c)
No-op method used to force the class initialization of the given class.
|
T |
newInstanceFromRadioList(net.sf.json.JSONObject config)
Creates a new instance of a
Describable
from the structured form submission data posted
by a radio button group. |
T |
newInstanceFromRadioList(net.sf.json.JSONObject parent,
String name)
Creates a new instance of a
Describable
from the structured form submission data posted
by a radio button group. |
boolean |
remove(Object o) |
int |
size() |
addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
@Deprecated public DescriptorList(Descriptor<T>... descriptors)
DescriptorList(Class)
instead.DescriptorList
that is disconnected from
ExtensionList
.public DescriptorList(Class<T> type)
DescriptorList
backed by ExtensionList
.public Descriptor<T> get(int index)
get
in interface List<Descriptor<T extends Describable<T>>>
get
in class AbstractList<Descriptor<T extends Describable<T>>>
public int size()
size
in interface Collection<Descriptor<T extends Describable<T>>>
size
in interface List<Descriptor<T extends Describable<T>>>
size
in class AbstractCollection<Descriptor<T extends Describable<T>>>
public Iterator<Descriptor<T>> iterator()
iterator
in interface Iterable<Descriptor<T extends Describable<T>>>
iterator
in interface Collection<Descriptor<T extends Describable<T>>>
iterator
in interface List<Descriptor<T extends Describable<T>>>
iterator
in class AbstractList<Descriptor<T extends Describable<T>>>
@Deprecated public boolean add(Descriptor<T> d)
Extension
on your descriptor to have it auto-registered,
instead of registering a descriptor manually.add
in interface Collection<Descriptor<T extends Describable<T>>>
add
in interface List<Descriptor<T extends Describable<T>>>
add
in class AbstractList<Descriptor<T extends Describable<T>>>
@Deprecated public void add(int index, Descriptor<T> element)
Extension
on your descriptor to have it auto-registered,
instead of registering a descriptor manually.add
in interface List<Descriptor<T extends Describable<T>>>
add
in class AbstractList<Descriptor<T extends Describable<T>>>
public boolean remove(Object o)
remove
in interface Collection<Descriptor<T extends Describable<T>>>
remove
in interface List<Descriptor<T extends Describable<T>>>
remove
in class AbstractCollection<Descriptor<T extends Describable<T>>>
@CheckForNull public T newInstanceFromRadioList(net.sf.json.JSONObject config) throws Descriptor.FormException
Describable
from the structured form submission data posted
by a radio button group.config
- Submitted configuration for Radio Listnull
if none was selected in the radio list or if the value is filtered by a DescriptorVisibilityFilter
Descriptor.FormException
- Data submission error@CheckForNull public T newInstanceFromRadioList(net.sf.json.JSONObject parent, String name) throws Descriptor.FormException
Describable
from the structured form submission data posted
by a radio button group.parent
- JSON, which contains the configuration entry for the radio listname
- Name of the configuration entry for the radio listnull
if none was selected in the radio list or if the value is filtered by a DescriptorVisibilityFilter
Descriptor.FormException
- Data submission error@CheckForNull public Descriptor<T> findByName(String id)
Descriptor.getId()
.id
- Descriptor IDnull
is returned.public void load(Class<? extends Describable> c)
DescriptorList
.
This is necessary to resolve the class initialization order problem.
Often a DescriptorList
is defined in the base class, and
when it tries to initialize itself by listing up descriptors of known
sub-classes, they might not be available in time.
@Deprecated @CheckForNull public Descriptor<T> find(String fqcn)
Descriptor.getId()
? A Describable
class name?Copyright © 2004–2021. All rights reserved.