Package hudson.model

Interface ReconfigurableDescribable<T extends ReconfigurableDescribable<T>>

All Superinterfaces:
Describable<T>
All Known Implementing Classes:
AbstractCIBase, AbstractCloudSlave, ApiTokenProperty, BuildDiscarderProperty, ConsoleUrlProviderUserProperty, DiskSpaceMonitorNodeProperty, DumbSlave, EnvironmentVariablesNodeProperty, FederatedLoginServiceUserProperty, Hudson, HudsonPrivateSecurityRealm.Details, Jenkins, JobProperty, LastGrantedAuthoritiesProperty, MyViewsProperty, Node, NodeProperty, OptionalJobProperty, PaneStatusProperties, ParametersDefinitionProperty, Slave, TimeZoneProperty, ToolLocationNodeProperty, UserExperimentalFlagsProperty, UserProperty, UserSearchProperty, UserSeedProperty, ViewProperty

public interface ReconfigurableDescribable<T extends ReconfigurableDescribable<T>> extends Describable<T>
Marks modern Describables that allow the current instances to pass information down to the next instance when the configuration is submitted.

As the generics signature implies, it isn't up to individual Describable implementation to implement this. Rather, it is up to the designer of an extension point to mark the extension point as ReconfigurableDescribable, as it requires coordination at the owner of the extension point.

Invisible Property: This mechanism can be used to create an entirely invisible Describable, which is handy for NodeProperty, JobProperty, etc. To do so, define an empty config.jelly to prevent it from showing up in the config UI, then implement reconfigure(StaplerRequest2, JSONObject) and simply return this.

Passing some values without going through clients: Sometimes your Describable object may have some expensive objects that you might want to hand over to the next instance. This hook lets you do that.

Since:
1.406
Author:
Kohsuke Kawaguchi
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    reconfigure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject form)
    When a parent/owner object of a Describable gets a config form submission and instances are recreated, this method is invoked on the existing instance (meaning the 'this' reference points to the existing instance) to create a new instance to be added to the parent/owner object.
    default T
    reconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form)

    Methods inherited from interface hudson.model.Describable

    getDescriptor
  • Method Details

    • reconfigure

      @CheckForNull @StaplerNotDispatchable default T reconfigure(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @CheckForNull net.sf.json.JSONObject form) throws Descriptor.FormException
      When a parent/owner object of a Describable gets a config form submission and instances are recreated, this method is invoked on the existing instance (meaning the 'this' reference points to the existing instance) to create a new instance to be added to the parent/owner object.

      The default implementation of this should be the following:

       return form==null ? null : getDescriptor().newInstance(req, form);
       
      Parameters:
      req - The current HTTP request being processed.
      form - JSON fragment that corresponds to this describable object. If the newly submitted form doesn't include a fragment for this describable (meaning the user has de-selected your descriptor), then this argument is null.
      Returns:
      The new instance. To not to create an instance of a describable, return null.
      Throws:
      Descriptor.FormException
    • reconfigure

      @CheckForNull @Deprecated @StaplerNotDispatchable default T reconfigure(@NonNull org.kohsuke.stapler.StaplerRequest req, @CheckForNull net.sf.json.JSONObject form) throws Descriptor.FormException
      Throws:
      Descriptor.FormException