Fluxtion generator will inject vector properties into the SEP at runtime. The properties are read during generation and the SEP will have the vector values hard-coded in the generated file. Using property injection client code can inject either default values or constant values into the SEP.
Property type support
The supported types that can be injected into a SEP member are:
Managed node references
byte
char
short
int
float
long
double
String
Enum
Collection support
The following collections are supported for injection:
Arrays
java.util.List
Injection mechanism
The following access patterns for property injection are supported:
Access Pattern
Description
Bean getter/setter
Fluxtion will look for a read/write bean pattern and generate a setXXX call in the SEP with a locally generated array or List
Final fields
A constructor must be available that matches exactly the final fields. If one exists Fluxtion will generate the constructor call, with a locally generated array or List.
public fields
Public fields are values are written in the generated SEP. The field must
non-transient, public scope and mutable. Fluxtion will assign a locally generated array or List
Example
The example demonstrates contstructor, public fields and bean pattern injection for arrays and Lists. The code generated depends upon the context of the injection.
Node class
public class PropertyHandler {
//final properties
private final boolean[] booleanFinalProp;
private final List<Integer> intFinalProp;
private final String[] stringFinalProp;
//public properties
public List<Boolean> booleanPublicProp;
public int[] intPublicProp;
public List<String> stringPublicProp;
public List<SampleEnum> enumPublioProp;
//bean properties
private boolean[] booleanBeanProp;
private List<Integer> intBeanProp;
private List<String> stringBeanProp;
private SampleEnum[] enumBeanProp;
public PropertyHandler(boolean[] booleanFinalProp, List<Integer> intFinalProp, String[] stringFinalProp) {
this.booleanFinalProp = booleanFinalProp;
this.intFinalProp = intFinalProp;
this.stringFinalProp = stringFinalProp;
}
public boolean[] getBooleanBeanProp() {
return booleanBeanProp;
}
public void setBooleanBeanProp(boolean[] booleanBeanProp) {
this.booleanBeanProp = booleanBeanProp;
}
public List<Integer> getIntBeanProp() {
return intBeanProp;
}
public void setIntBeanProp(List<Integer> intBeanProp) {
this.intBeanProp = intBeanProp;
}
public List<String> getStringBeanProp() {
return stringBeanProp;
}
public void setStringBeanProp(List<String> stringBeanProp) {
this.stringBeanProp = stringBeanProp;
}
public SampleEnum[] getEnumBeanProp() {
return enumBeanProp;
}
public void setEnumBeanProp(SampleEnum[] enumBeanProp) {
this.enumBeanProp = enumBeanProp;
}
@EventHandler
public void myEvent(MyEvent event){
}
@Initialise
public void init(){
//calculate and set any derived properties here
}
}
SEPConfig builder
Multiple vector access patterns are exercised in the builder. All the vector values are read at generation time and written into the generated SEP.