code: public <T extends Descriptor> T getDescriptorByType(Class<T> type) {
          for( Descriptor d : getExtensionList(Descriptor.class) )
              if(d.getClass()==type)
                  return type.cast(d);
          return null;
      }
docs: Gets the {@link Descriptor} instance in the current Jenkins by its type.