Class UninstantiatedDescribable

java.lang.Object
org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable
All Implemented Interfaces:
Serializable

public class UninstantiatedDescribable extends Object implements Serializable
A reflection-like view of a particular Describable instance.
Author:
Kohsuke Kawaguchi
See Also:
  • Field Details

  • Constructor Details

    • UninstantiatedDescribable

      public UninstantiatedDescribable(String symbol, String klass, Map<String,?> arguments)
    • UninstantiatedDescribable

      public UninstantiatedDescribable(Map<String,?> arguments)
  • Method Details

    • withArguments

      public UninstantiatedDescribable withArguments(Map<String,?> arguments)
      Makes a copy of this struct with an alternate argument map.
      Parameters:
      arguments - a replacement for getArguments()
      Returns:
      a new object with the same getSymbol(), getKlass(), and getModel()
    • getSymbol

      @Nullable public String getSymbol()
      If this nested describable has a suitable symbol name, this method returns one.

      Either this or getKlass() has to return a non-null value.

    • setSymbol

      public void setSymbol(String symbol)
    • getKlass

      @Nullable public String getKlass()
      "$class" is an alternative means to specify the class in case there's no symbol. Can be a short name if it's contextually unambiguous, or a FQCN.

      Either this or getSymbol() has to return a non-null value.

    • setKlass

      public void setKlass(String klass)
    • getModel

      @CheckForNull public DescribableModel getModel()
      Returns the model associated with this object. If this object was created from a model (via from(Object)) this method returns that model.
    • setModel

      public void setModel(DescribableModel model)
    • getArguments

      public Map<String,?> getArguments()
      All the nested arguments to this object.
    • hasSoleRequiredArgument

      public boolean hasSoleRequiredArgument()
      Returns true if and only if the arguments is one and that is the only required parameter from the model.

      This usually signals a short-hand syntax to write down the instantiation syntax.

    • toMap

      public Map<String,Object> toMap()
      For legacy use, we need to blow up this into a map form. This requires recursively blowing up any nested UninstantiatedDescribables.
    • toShallowMap

      public Map<String,Object> toShallowMap()
      Converts this UninstantiatedDescribable to a literal map expression without recursively doing so for children.
    • instantiate

      @Deprecated public Object instantiate() throws Exception
      Deprecated.
      Throws:
      Exception
    • instantiate

      public Object instantiate(TaskListener listener) throws Exception
      Instantiates an actual Describable through the model, unless klass or symbol will be set to specify a specific type, in which case that takes a precedence.
      Parameters:
      listener - Listener to record any instantiation warnings
      Returns:
      The instantiated object
      Throws:
      Exception
    • instantiate

      @Deprecated public <T> T instantiate(Class<T> base) throws Exception
      Deprecated.
      Throws:
      Exception
    • instantiate

      public <T> T instantiate(Class<T> base, TaskListener listener) throws Exception
      Instantiates an actual Describable object from the specified arguments.
      Parameters:
      base - The expected type of the instance. The interpretation of the symbol and $class depends on this parameter.
      listener - Listener to record any instantiation warnings
      Returns:
      The instantiated object
      Throws:
      Exception
    • from

      public static UninstantiatedDescribable from(Object o)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Debug assistance. The output might change.
      Overrides:
      toString in class Object