Fluent builder for a points expiry rule type contributed by an app, reached from controllerMappings.pointsExpiryRuleTypeBuilder(id, title). A points expiry rule type decides when a member's accrued points expire. Add any configuration fields shown to admins with addField, set the JS function that calculates the expiry date with processFn, then call build to create and register the rule type for use in points programmes.

Group: Builders


Methods

processFn(String s)

Returns: PointsExpiryRuleTypeBuilder

Sets the name of the JS function called to calculate a member's points expiry date under this rule type.

ParameterDescription
sthe JS function name

addField(String name, String title)

Returns: PointsExpiryRuleTypeBuilder

Adds a configuration field shown to admins with the given title and no help text, using its default input type.

ParameterDescription
namethe field's name
titlethe field's display title

addField(String name, String text, String title)

Returns: PointsExpiryRuleTypeBuilder

Adds a configuration field shown to admins with the given title and help text, using its default input type.

ParameterDescription
namethe field's name
texthelp text shown alongside the field
titlethe field's display title

addField(String name, String text, String title, String options)

Returns: PointsExpiryRuleTypeBuilder

Adds a configuration field, parsing its input type, requirement and selectable options from the compact options string (see ExtraField.parse for the format).

ParameterDescription
namethe field's name
texthelp text shown alongside the field, may be null
titlethe field's display title
optionsthe semicolon-separated field configuration string, may be null

addField(String name, String text, String title, boolean required, List<String> options)

Returns: PointsExpiryRuleTypeBuilder

Adds a configuration field with an explicit requirement flag and a fixed list of selectable options.

ParameterDescription
namethe field's name
texthelp text shown alongside the field, may be null
titlethe field's display title
requiredwhether the field must be given a value
optionsthe selectable option values for the field

addFieldWithOptionsFn(String name, String text, String title, boolean required, Supplier<List<String>> optionsFn)

Returns: PointsExpiryRuleTypeBuilder

Adds a configuration field with an explicit requirement flag, whose selectable options are computed on demand by the given supplier rather than fixed up front.

ParameterDescription
namethe field's name
texthelp text shown alongside the field, may be null
titlethe field's display title
requiredwhether the field must be given a value
optionsFnsupplier that computes the field's selectable option values

build()

Returns: JsPointsExpiryRuleType

Builds the points expiry rule type from the values set on this builder and registers it with the app's controller mapping list for use in points programmes.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.