DescribableModel
public class DescribableHelper extends Object
Describable
s (and some other objects) and map-like representations.
Ultimately should live in Jenkins core (or Stapler).Modifier and Type | Class and Description |
---|---|
static class |
DescribableHelper.ArrayType
Deprecated.
|
static class |
DescribableHelper.AtomicType
Deprecated.
|
static class |
DescribableHelper.EnumType
Deprecated.
|
static class |
DescribableHelper.ErrorType
Deprecated.
|
static class |
DescribableHelper.HeterogeneousObjectType
Deprecated.
A parameter (or array element) which could take any of the indicated concrete object types.
|
static class |
DescribableHelper.HomogeneousObjectType
Deprecated.
|
static class |
DescribableHelper.ParameterType
Deprecated.
A type of a parameter to a class.
|
static class |
DescribableHelper.Schema
Deprecated.
Definition of how a particular class may be configured.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
instantiate(Class<? extends T> clazz,
Map<String,?> arguments)
Deprecated.
Creates an instance of a class via
DataBoundConstructor and DataBoundSetter . |
static DescribableHelper.Schema |
schemaFor(Class<?> clazz)
Deprecated.
Loads a definition of the structure of a class: what kind of data you might get back from
uninstantiate(java.lang.Object) on an instance,
or might want to pass to instantiate(java.lang.Class<? extends T>, java.util.Map<java.lang.String, ?>) . |
static Map<String,Object> |
uninstantiate(Object o)
Deprecated.
Computes arguments suitable to pass to
instantiate(java.lang.Class<? extends T>, java.util.Map<java.lang.String, ?>) to reconstruct this object. |
public static final String CLAZZ
public static <T> T instantiate(Class<? extends T> clazz, Map<String,?> arguments) throws Exception
DataBoundConstructor
and DataBoundSetter
.
The arguments may be primitives (as wrappers) or String
s if that is their declared type.
Character
s, Enum
s, and URL
s may be represented by String
s.
Other object types may be passed in “raw” as well, but JSON-like structures are encouraged instead.
Specifically a List
may be used to represent any list- or array-valued argument.
A Map
with String
keys may be used to represent any class which is itself data-bound.
In that case the special key CLAZZ
is used to specify the Class.getName()
;
or it may be omitted if the argument is declared to take a concrete type;
or Class.getSimpleName()
may be used in case the argument type is Describable
and only one subtype is registered (as a Descriptor
) with that simple name.
Exception
public static Map<String,Object> uninstantiate(Object o) throws UnsupportedOperationException
instantiate(java.lang.Class<? extends T>, java.util.Map<java.lang.String, ?>)
to reconstruct this object.o
- a data-bound objectUnsupportedOperationException
- if the class does not follow the expected structurepublic static DescribableHelper.Schema schemaFor(Class<?> clazz)
uninstantiate(java.lang.Object)
on an instance,
or might want to pass to instantiate(java.lang.Class<? extends T>, java.util.Map<java.lang.String, ?>)
.Copyright © 2016–2017. All rights reserved.