Class SBPropertyDescriptor.SingleValueSetter
java.lang.Object
com.streambase.sb.operator.parameter.SBPropertyDescriptor.SingleValueSetter
- Enclosing class:
- SBPropertyDescriptor
This abstract specialization of Setter assumes that the
property type will have a single value (which currently
accounts for all property types except string lists). It
extracts the value of that parameter from the map and calls an
abstract parse method on it.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object[]
getArgs
(SBPropertyDescriptor pd, Map<String, List<Object>> params, SchemaUtil.SchemaProvider schemaProvider) Get the setter arguments for Method.invoke, consume the property values.protected String
getSingleValue
(SBPropertyDescriptor pd, Map<String, List<Object>> params) getValue
(SBPropertyDescriptor pd, Parameterizable bean) Get valueString[]
getValues
(SBPropertyDescriptor pd, Parameterizable bean) Get array valueprotected abstract Object[]
parseArgs
(SBPropertyDescriptor pd, String val, SchemaUtil.SchemaProvider schemaProvider) Parse the single argument value from a string into the array of parameters to pass to the setter method.void
set
(SBPropertyDescriptor pd, Object bean, Map<String, List<Object>> params, SchemaUtil.SchemaProvider schemaProvider) Set the param
-
Constructor Details
-
SingleValueSetter
protected SingleValueSetter()
-
-
Method Details
-
getArgs
protected Object[] getArgs(SBPropertyDescriptor pd, Map<String, List<Object>> params, SchemaUtil.SchemaProvider schemaProvider) throws TypecheckExceptionGet the setter arguments for Method.invoke, consume the property values. Returns null to indicate that the setter should not be called (ie, if an optional parameter was omitted)- Parameters:
pd
- property descriptorparams
- parametersschemaProvider
- a schema provider- Returns:
- null if the setter should not be called
- Throws:
TypecheckException
- on type check exception
-
parseArgs
protected abstract Object[] parseArgs(SBPropertyDescriptor pd, String val, SchemaUtil.SchemaProvider schemaProvider) throws TypecheckException Parse the single argument value from a string into the array of parameters to pass to the setter method. This can return null to skip calling the setter.- Parameters:
pd
- a property descriptorval
- for the setter methodschemaProvider
- a schema provider- Returns:
- null if the setter should not be called
- Throws:
TypecheckException
- on type check exception
-
set
public void set(SBPropertyDescriptor pd, Object bean, Map<String, List<Object>> params, SchemaUtil.SchemaProvider schemaProvider) throws TypecheckExceptionSet the param- Parameters:
pd
- a property descriptorbean
- a beanparams
- parametersschemaProvider
- a schema provider- Throws:
TypecheckException
- on type check exception
-
getValue
Get value- Parameters:
pd
- property descriptorbean
- Java bean- Returns:
- value
- Throws:
TypecheckException
- error accessing value
-
getValues
Get array value- Parameters:
pd
- property descriptorbean
- Java bean- Returns:
- values
- Throws:
TypecheckException
- error accessing values
-
getSingleValue
protected String getSingleValue(SBPropertyDescriptor pd, Map<String, List<Object>> params) throws TypecheckException- Parameters:
pd
- a property descriptorparams
- parameters- Returns:
- the string value of the property, or null if the property is optional and omitted
- Throws:
TypecheckException
- on type check exception
-