Package hudson.util

Class DescriptorList<T extends Describable<T>>

  • All Implemented Interfaces:
    Iterable<Descriptor<T>>, Collection<Descriptor<T>>, List<Descriptor<T>>

    public final class DescriptorList<T extends Describable<T>>
    extends AbstractList<Descriptor<T>>
    List of Descriptors.

    Before Hudson 1.286, this class stored Descriptors 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 Descriptors 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.

    Since:
    1.161
    Author:
    Kohsuke Kawaguchi