Annotation for compound parameters.
The object annotated must be a field whose type matches a class
that has a CompoundParmType annotation.
This class must have a constructor with zero arguments and will
have some or all of its fields annotated by a PrimitiveParm
annotation. An instance created using a zero-argument constructor
must be used in the initializer, which is mandatory. The initial
value may use a subclass.
For example,
This will define factory parameters whose names are "value.size" and "value.base" that will be initialized using a method named set. A delimiter is provided, that will be inserted after the string "map" in the name, with a default delimiter ".". If no delimiter is desired, set the delimiter to an empty string. Thus, to set a value, one might use@CompoundParmType class Value { @PrimitiveParm("Size") int size = 10; @PrimitiveParm("Base") int base = 0; } @FactoryParmManager("OurFactoryParmManager") public class OurFactory extends ... { @CompoundParm("value") Value value = new Value(); ... }
OurFactory factory; ... factory.set("value.base", 10); factory.set("value.size", 20);
As an example of using a subclass in an initializer
will configure edgeColor so its default value produces the color red. By contrast, the definition@CompoundParm("edgeColor") ColorParm edgeColor = new ColorParm.RED();
will result in the color provided by ColorParm's zero-argument constructor, which is not what is desired: whenever edgeColor is reset to its default, the value's constructor will be called.@CompoundParm("edgeColor") ColorParm edgeColor = new ColorParm(Color.RED);
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements