Set
, the set's type parameter can be a
named-object type, an Integer, a String, or an Enumeration. In
this case the factory is configured by using 'add' methods,
which add entries to a set.
Otherwise the factory is configure using 'set' methods, and
the type of the field being annotated is constrained
based on the value of the rvmode() element. When rvmode() is false,
the type of the field must be boolean, int, double, long, String,
BooleanRandomVariable
,
IntegerRandomVariable
,
LongRandomVariable
DoubleRandomVariable
,
an enumeration type or a named-object type or a Set whose type
parameter is Integer, Double, Long, String, an enumeration type, or
the type of a named object. When rvmode is true, the type of the
field must be BooleanRandomVariable
,
IntegerRandomVariable
,
LongRandomVariable
,
DoubleRandomVariable
,
BooleanRandomVariableRV<BRV extends BooleanRandomVariable>
,
IntegerRandomVariableRV<IRV extends IntegerRandomVariable>
,
LongRandomVariableRV<LRV extends LongRandomVariable>
or
DoubleRandomVariableRV<DRV extends DoubleRandomVariable>
. When rvmode() is
false, the value used is the value of the field. When rvmode() is
true, the value used is the value returned by the field's next()
method.
The field's declaration must initialize the field with its default value.
When this annotation is used, the corresponding
Parm
object is also created as part of
the ParmManager<T extends NamedObjectFactory>
that will be generated.
For example
will define parameters named size and base that can be set.@FactoryParmManager("OurFactoryParmManager") public class OurFactory extends ... { @PrimitiveParm("size") int size = 10; @PrimitiveParm("base") int base = 0; ... }
- See Also:
-
ParmManager<T extends NamedObjectFactory>
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe lower bound for a parameter's value; the string "null" if there is none.boolean
A boolean that is true if the lower bound is included in the parameter's range; false if it is not.boolean
The parameter's random-variable mode.The upper bound for a parameter's value; the string "null" if there is none.boolean
A boolean that is true if the upper bound is included in the parameter's range; false if it is not.
-
Element Details
-
value
String valueThe name of the parameter.- Returns:
- the parameter name
-
-
-
rvmode
boolean rvmodeThe parameter's random-variable mode. When false, the type of the parameter is the type of the field being annotated. When true, the type of the field being annotated must be a random-variable type and the type of the parameter is the type of the object that the random-variable produces when itsnext()
method must be called to obtain the value when the field is used to initialize an object. The type of the parameter, when rvmode() is true, will be one of the primitive types int, double, long, or boolean when the field is a subclass of IntegerRandomVariable, DoubleRandomVariable, LongRandomVariable, or BooleanRandomVariable respectively. The type of the parameter, again when rvmode() is true, will be a random variable of the type generated by the field's type when the type of the field is a random variable that generates other random variables. Specifically, when the rvmode() is true and the type of the field is a random variable that generates other random variables, the type of the random variable generated must be IntegerRandomVariable, DoubleRandomVariable, LongRandomVariable, or BooleanRandomVariable.From a user's viewpoint,
- When rvmode() is false, the value is simply used as is, perhaps with some type conversions. For example, if the field is a random variable, a number will be converted to a random variable that repeats the same value, but in either case the field's value will be used to configure the object. Similarly, if a field is an integer, and that field is set to a random number, the random number's next() method will be called when set is called, and the number produced will be the one used to configure the factory, after which all objects created with the factory will use the same value for that field until the factory configuration for that field is changed.
- When rvmode() is true, for each object created, the factory will obtain the next value of a random variable and use that to configure an object. This is useful primarily with factory methods that create arrays of random variables, where one wants each object to have a different value (the factory must be explicitly coded to call the random variable's next() method to do this).
- Returns:
- the random-variable mode
- Default:
- false
-
upperBound
String upperBoundThe upper bound for a parameter's value; the string "null" if there is none.- Returns:
- the upper bound
- Default:
- "null"
-
upperBoundClosed
boolean upperBoundClosedA boolean that is true if the upper bound is included in the parameter's range; false if it is not.- Returns:
- true if the upper bound is included in the parameter's range; false if it is not
- Default:
- true
-
lowerBound
String lowerBoundThe lower bound for a parameter's value; the string "null" if there is none.- Returns:
- the lower bound
- Default:
- "null"
-
lowerBoundClosed
boolean lowerBoundClosedA boolean that is true if the lower bound is included in the parameter's range; false if it is not.- Returns:
- true if the lower bound is included in the parameter's range; false if it is not.
- Default:
- true
-