Reference Data
Some domain classes are immutable to the user, and moreover have only a fixed number of instances. Often these are "reference" ("standing") data, or lookup data/pick lists. Typical examples could include categories, countries, states, and tax or interest rate tables.
Where the number of instances is relatively small, ie bounded, then the bounding() element can be used as a hint. For such domain objects the framework will automatically allow instances to be selected; Web UI (Wicket viewer) displays these as a drop-down list.
For example:
@DomainObject(
bounding=Bounding.BOUNDED,
editing=Editing.DISABLED (1)
)
public class Currency {
...
}
| 1 | This attribute is commonly combined with editing=DISABLED to enforce the fact that reference data is immutable |
|
There is nothing to prevent you from using this attribute for regular mutable entities, and indeed this is sometimes worth doing during early prototyping. However, if there is no realistic upper bound to the number of instances of an entity that might be created, generally you should use autoComplete…() supporting method or the @DomainObject#autoCompleteRepository attribute instead. |