Occasionally a managed node may not expose its properties or constructors making it difficult to inject managed nodes or properties. This can happen if a class uses a static factory method that invokes a private constructor.
Fluxtion supports private member assignment and synthetic default constructor usage. All scalar and vector properties are supported in earlier sections. Non-transient fields will be ignored.
Warning
The Jvm security model is evolving and it is unlikely reflection support and synthetic default constructors will be available in the future. This facility should be validated on your target runtime.
Check reflection works on your target platform, support is nor guaranteed by Fluxtion.
Usage
The use of refelction assignment has to be explicitly enabled in the Fluxtion compiler with the following option:
-pa,--assignPrivate <arg> If set generated SEP will
attempt to use reflection style
assignment for private
non-transient members
With the Fluxtion maven plugin the feature must be explicitly enabled:
fluxtion:generate
Description: A mojo to wrap the invocation of the Fluxtion executable.
Implementation: com.fluxtion.maven.FluxtionGeneratorMojo
Language: java
Bound to phase: compile
Available parameters:
assignNonPublicMembers (Default: false)
User property: assignNonPublicMembers
Override whether the generated static event processor supports reflection
based assignment for initialisation.
Example
The following example demonstrates reflection based assignment for a class with a static factory method, private constructor and no mutator methods for fields.