public class UninstantiatedDescribable extends Object implements Serializable
Describable instance.| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS_KEY
As a short-hand, if a
DescribableModel has only one required parameter,
instantiate(Class) accepts a single-item map whose key is this magic token. |
| Constructor and Description |
|---|
UninstantiatedDescribable(Map<String,?> arguments) |
UninstantiatedDescribable(String symbol,
String klass,
Map<String,?> arguments) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static UninstantiatedDescribable |
from(Object o) |
Map<String,?> |
getArguments()
All the nested arguments to this object.
|
String |
getKlass()
is an alternative means to specify the class in case there's no symbol.
|
DescribableModel |
getModel()
Returns the model associated with this object.
|
String |
getSymbol()
If this nested describable has a suitable symbol name,
this method returns one.
|
int |
hashCode() |
boolean |
hasSoleRequiredArgument()
Returns true if and only if the arguments is one and that is the only required parameter
from the model.
|
Object |
instantiate()
|
<T> T |
instantiate(Class<T> base)
Instantiates an actual
Describable object from the specified arguments. |
void |
setKlass(String klass) |
void |
setModel(DescribableModel model) |
void |
setSymbol(String symbol) |
Map<String,Object> |
toMap()
For legacy use, we need to blow up this into a map form.
|
Map<String,Object> |
toShallowMap()
Converts this
UninstantiatedDescribable to a literal map expression without recursively doing so for children. |
String |
toString()
Debug assistance.
|
public static final String ANONYMOUS_KEY
DescribableModel has only one required parameter,
instantiate(Class) accepts a single-item map whose key is this magic token.
To avoid clients from needing to special-case this key, from(Object) does not
produce arguments that contains this magic token. Clients who want
to take advantages of this should look at DescribableModel.hasSingleRequiredParameter()
public UninstantiatedDescribable(String symbol, String klass, Map<String,?> arguments)
@Nullable public String getSymbol()
Either this or getKlass() has to return a non-null value.
public void setSymbol(String symbol)
@Nullable public String getKlass()
Either this or getSymbol() has to return a non-null value.
public void setKlass(String klass)
public DescribableModel getModel()
from(Object)) this method
returns that model.public void setModel(DescribableModel model)
public boolean hasSoleRequiredArgument()
This usually signals a short-hand syntax to write down the instantiation syntax.
public Map<String,Object> toMap()
UninstantiatedDescribables.public Map<String,Object> toShallowMap()
UninstantiatedDescribable to a literal map expression without recursively doing so for children.public Object instantiate() throws Exception
Describable through the model,
unless klass or symbol will be set to specify a specific type, in which
case that takes a precedence.Exceptionpublic <T> T instantiate(Class<T> base) throws Exception
Describable object from the specified arguments.base - The expected type of the instance. The interpretation of the symbol and $class
depends on this parameter.Exceptionpublic static UninstantiatedDescribable from(Object o)
Copyright © 2016. All rights reserved.