We could make an enum with the int as a field with a getter, so that this precondition is enforced by types.