Creating the Configuration Bean
A configuration bean is used to bundle configuration parameters of an adapter instance and contains methods for setting the configuration parameters. Adapter instances can access the configuration bean object using the method getConfigurationBean()
.
Creating a Configuration Bean
How to create a new Configuration Bean class in the package
- Define variables which serve as configuration parameters (only of the type
String
). - The
@AdapterParameter
annotation specifies a field as adapter configuration. There can either be a Configuration Bean class in which all parameters are defined, or the definition can be made in the adapter class itself (a mixture is not possible!). - Define set/get methods for each configuration parameter. They have to be named following the pattern:
set<Parameter name>(<value>)
orget<Parameter name>()
.
The basic frame of the configuration bean is now ready.
Defining Metadata for Adapter Parameters
To define metadata for adapter parameters the @AdapterParameter
annotation is used:
Field | Description | Mandatory |
---|---|---|
description | Textual description of the parameter's purpose | yes |
dataType | Parameter type Possible values: | yes |
displayName | The parameter's display name. The field's name is default. | no |
optional | Specifies whether the parameter is mandatory or not Possible values:
| no |
defaultValue | Sets an initial parameter value | no |
@AllowedPropertyValue
has to be used additionally, if dataType
is set to ARRAY
in order to set the possible values.
Field | Description |
---|---|
displayName | Specifies the value's display name |
value | Technical identifier that is written to the field during selection |
Example
import de.softproject.integration.adapter.annotations.AdapterParameter;
import de.softproject.integration.adapter.core.AdapterParameterDataType;
public class SimpleChartConfiguration {
@AdapterParameter(dataType = AdapterParameterDataType.STRING, description = "set the title of the chart")
private String chartTitle;
@AdapterParameter(dataType = AdapterParameterDataType.INTEGER, description = "set the width of the chart", defaultValue = "300")
private int chartWidth = 300;
public String getChartTitle() {
return chartTitle;
}
public void setChartTitle(String chartTitle) {
this.chartTitle = chartTitle;
}
public int getChartWidth() {
return chartWidth;
}
public void setChartWidth(int chartWidth) {
this.chartWidth = chartWidth;
}
}