Package chemaxon.marvin.services
Class ServiceArgument<T>
java.lang.Object
chemaxon.marvin.services.ServiceArgument<T>
- Type Parameters:
T
- the type of the argument
- Direct Known Subclasses:
DynamicArgument
Describes an argument passed to services
- Since:
- 5.6
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
ServiceArgument
(Class<T> type, T value) Constructs a service argument with specified type and valueprotected
ServiceArgument
(Class<T> type, T value, boolean constant) Constructs a service argument with specified type and value -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ServiceArgument<T>
createArgument
(String name, T value) Returns a service argument based on valuestatic <T> ServiceArgument<T>
createArgument
(T value) Returns a service argument based on valuestatic <T> ServiceArgument<T>
createArgumentAs
(String name, T value, Class<T> type) Returns a service argument based on value and typestatic <T> ServiceArgument<T>
createArgumentAs
(T value, Class<T> type) Returns a service argument based on value and typestatic ServiceArgument<?>
createConstantFromString
(String value, Class<?> argumentClass) getAlias()
Returns the argument alias.getName()
Returns the name of the argumentgetType()
Returns the argument typegetValue()
Returns the argument valueboolean
isValid()
Returnstrue
if service argument is validvoid
Sets the argument alias.void
Sets the name of the argumentvoid
Sets the class of the argumentvoid
Sets the service argument valuetoString()
-
Field Details
-
type
type of the argument -
value
value of the argument -
constant
protected final boolean constantfield indicates constant argument -
name
the name of the argument -
alias
the alias of the argument
-
-
Constructor Details
-
ServiceArgument
Constructs a service argument with specified type and value- Parameters:
type
- the argument typevalue
- the argument value
-
ServiceArgument
Constructs a service argument with specified type and value- Parameters:
type
- the argument typevalue
- the argument valueconstant
- the constant flag
-
-
Method Details
-
createArgument
Returns a service argument based on value- Type Parameters:
T
- the argument type- Parameters:
value
- the argument value- Returns:
- a constant service argument based on value
-
createArgument
Returns a service argument based on value- Type Parameters:
T
- the argument type- Parameters:
name
- argument namevalue
- the argument value- Returns:
- a constant service argument based on value
-
createArgumentAs
Returns a service argument based on value and type- Type Parameters:
T
- the argument type- Parameters:
value
- the argument valuetype
- the argument type- Returns:
- a constant service argument based on value
-
createArgumentAs
Returns a service argument based on value and type- Type Parameters:
T
- the argument type- Parameters:
name
- the argument namevalue
- the argument valuetype
- the argument type- Returns:
- a constant service argument based on value
-
getType
Returns the argument type- Returns:
- the argument type
-
setType
Sets the class of the argument- Parameters:
argumentType
- the argument class
-
getValue
Returns the argument value- Returns:
- the argument value
-
setValue
Sets the service argument value- Parameters:
value
- the new value
-
isValid
public boolean isValid()Returnstrue
if service argument is valid- Returns:
true
if service argument is valid
-
getName
Returns the name of the argument- Returns:
- the name of the argument
-
setName
Sets the name of the argument- Parameters:
name
- the new argument name
-
getAlias
Returns the argument alias. Aliases may be used to call services in a user friendly way by parsing user input.- Returns:
- the argument alias or
null
if no alias set
-
setAlias
Sets the argument alias. Aliases may be used to call services in a user friendly way by parsing user input.- Parameters:
alias
- the new alias
-
toString
-
createConstantFromString
Creates aServiceArgument
constant based on string value and argument type.
Supported types areString
,Integer
,Long
,Double
,Float
andBoolean
- Parameters:
value
- the string valueargumentClass
- the requested service argument type- Returns:
ServiceArgument
instance based on value and class, ornull
-