Scalar property injection
Injecting scalar properties into a managed node
Introduction
Fluxtion generator will inject scalar properties into the SEP at runtime. The properties are read at generation time and the generated SEP will have the 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
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
Final fields
A constructor must be available that matches exactly the final fields. If one exists Flxution will generate the constructor call.
public fields
Public fields are values are written in the generated SEP. The field must
non-transient, public scope and mutable.
Constructor/field matching will use the logic described here.
Derived final fields are not supported, the class must have a constructor referencing all the final fields.
Example
The example demonstrates all the capabilities of scalar property injection: final fields with constructors, public properties, bean properties and transient properties. The generated SEP contains the values set in the builder.
The example is located here
Node class
SEPConfig builder
The builder sets the property values for reading at generation time.
Generated SEP
The generated SEP contains the member values as read at generation time. Complex constructors, bean pattern and public fields are all supported.
Note
Transient field values are not written in the SEP.
All values set before constructor exits
Last updated
Was this helpful?