public class ValueInjector
extends java.lang.Object
Constructor and Description |
---|
ValueInjector() |
Modifier and Type | Method and Description |
---|---|
<T> void |
addConverter(java.lang.Class<T> clazz,
StringConverter<T> conv)
Registers the given converter for the specified class.
|
static ValueInjector |
createDefault()
Returns a fresh instance of a
ValueInjector with the support
for basic primitive data types. |
<T> StringConverter<T> |
getConverter(java.lang.Class<T> clazz)
Finds a converter for the given class.
|
static ValueInjector |
getInstance()
Returns the default instance of a
ValueInjector
Use with care. |
<T> T |
inject(ProofScriptCommand<?> command,
T obj,
java.util.Map<java.lang.String,java.lang.String> arguments)
Injects the converted version of the given
arguments in the given obj . |
static <T> T |
injection(ProofScriptCommand<?> command,
T obj,
java.util.Map<java.lang.String,java.lang.String> arguments)
Injects the given
arguments in the obj . |
public static <T> T injection(ProofScriptCommand<?> command, T obj, java.util.Map<java.lang.String,java.lang.String> arguments) throws ArgumentRequiredException, InjectionReflectionException, NoSpecifiedConverterException, ConversionException
arguments
in the obj
.
For more details see inject(ProofScriptCommand, Object, Map)
T
- an arbitrary typecommand
- a proof script commandobj
- a parameter class with annotationarguments
- a non-null map of string pairsobj
ArgumentRequiredException
- a required argument was not given in arguments
InjectionReflectionException
- an access on some reflection methods occurredNoSpecifiedConverterException
- unknown type for the current converter mapConversionException
- an converter could not translate the given value in
argumentspublic static ValueInjector getInstance()
ValueInjector
Use with care. No multi-threading.createDefault()
public static ValueInjector createDefault()
ValueInjector
with the support
for basic primitive data types.public <T> T inject(ProofScriptCommand<?> command, T obj, java.util.Map<java.lang.String,java.lang.String> arguments) throws ConversionException, InjectionReflectionException, NoSpecifiedConverterException, ArgumentRequiredException
arguments
in the given obj
.T
- type safetycommand
- a proof script commandobj
- a non-null instance of a parameter class (with annotation)arguments
- a non-null string mapobj
ArgumentRequiredException
- a required argument was not given in arguments
InjectionReflectionException
- an access on some reflection methods occurredNoSpecifiedConverterException
- unknown type for the current converter mapConversionException
- an converter could not translate the given value
in argumentsOption
,
Flag
public <T> void addConverter(java.lang.Class<T> clazz, StringConverter<T> conv)
T
- an arbitrary typeclazz
- a classconv
- a converter for the given classpublic <T> StringConverter<T> getConverter(java.lang.Class<T> clazz)
T
- an arbitrary typeclazz
- a non-null classCopyright © 2003-2019 The KeY-Project.