@ValueSemantics

Collects all the value-type specific customization attributes.

API

ValueSemantics.java
@interface ValueSemantics {
  public final static int AS_DAY_BEFORE;     (1)
  String provider() default "";     (2)
  int maxTotalDigits() default 0;     (3)
  int maxIntegerDigits() default 0;     (4)
  int minIntegerDigits() default 1;     (5)
  int maxFractionalDigits() default -1;     (6)
  int minFractionalDigits() default 0;     (7)
  FormatStyle dateFormatStyle() default FormatStyle.MEDIUM;     (8)
  FormatStyle timeFormatStyle() default FormatStyle.MEDIUM;     (9)
  TimePrecision timePrecision() default TimePrecision.SECOND;     (10)
  TimeZoneTranslation timeZoneTranslation() default TimeZoneTranslation.TO_LOCAL_TIMEZONE;     (11)
  int dateRenderAdjustDays() default 0;     (12)
}
1 AS_DAY_BEFORE

eg. @ValueSemantics(dateRenderAdjustDays = ValueSemantics.AS_DAY_BEFORE)

2 provider

Allows to select ValueSemanticsProvider (s) by qualifier.

3 maxTotalDigits

If associated with BigDecimal , BigInteger , or any Java integer type (long, int, short, byte), the maximum number of total digits accepted for input (editing).

4 maxIntegerDigits

If associated with any Java number type BigDecimal , BigInteger , long, int, short, byte, double or float, the maximum number of integer digits required for input (editing).

5 minIntegerDigits

If associated with any Java number type BigDecimal , BigInteger , long, int, short, byte, double or float, the minimum number of integer digits required for input (editing).

6 maxFractionalDigits

If associated with any non-integer Number type, the maximum number of fractional decimal digits displayed.

7 minFractionalDigits

If associated with any non-integer Number type, the minimum number of fractional digits displayed.

8 dateFormatStyle

If associated with a temporal date value, the rendering style of a localized date.

9 timeFormatStyle

If associated with a temporal time value, the rendering style of a localized time.

10 timePrecision

If associated with a temporal time value, the time of day precision, used for editing a time field in the UI.default = TimePrecision#SECOND

11 timeZoneTranslation

If associated with a temporal value, that has time-zone or time-offset information, the rendering mode, as to whether to transform the rendered value to the user’s local/current time-zone or not.

12 dateRenderAdjustDays

If associated with a date or date-time value, instructs whether the date should be rendered as n days after the actually stored date. For negative n its days before respectively.

Members

AS_DAY_BEFORE

eg. @ValueSemantics(dateRenderAdjustDays = ValueSemantics.AS_DAY_BEFORE)

provider

Allows to select ValueSemanticsProvider (s) by qualifier.

maxTotalDigits

If associated with BigDecimal , BigInteger , or any Java integer type (long, int, short, byte), the maximum number of total digits accepted for input (editing).

But input is not constrained for double/float, since those types have fixed intrinsic precision and their bit representation does not directly correspond to decimal digits. Further more, double/float may support scientific notation for input (as well as display), where the notion of 'total digits' is no longer viable.

When Column#precision() >0 is used, while ValueSemantics#maxTotalDigits() is not used (⇐0), then Column#precision() is undersood as an alias for this annotation attribute.

default = 0 understood as unlimited

maxIntegerDigits

If associated with any Java number type BigDecimal , BigInteger , long, int, short, byte, double or float, the maximum number of integer digits required for input (editing).

For double/float specifically, requires their decimal representation, to satisfy this requirement. Those types may support scientific notation for input (as well as display), where the notion of 'integer digits' is still viable.

Digits#integer() can be used as a replacement. If both are used, the stronger constraint applies.

default = 0 understood as unlimited

minIntegerDigits

If associated with any Java number type BigDecimal , BigInteger , long, int, short, byte, double or float, the minimum number of integer digits required for input (editing).

For double/float specifically, requires their decimal representation, to satisfy this requirement. Those types may support scientific notation for input (as well as display), where the notion of 'integer digits' is still viable.

default = 1

maxFractionalDigits

If associated with any non-integer Number type, the maximum number of fractional decimal digits displayed.

If associated with a BigDecimal specifically, also governs the maximum number of fractional digits accepted for input (editing).

But input is not constrained for double/float, since those types have fixed intrinsic precision and their bit representation does not directly correspond to decimal digits.

Digits#fraction() can be used as a replacement. If both are used, the stronger constraint applies.

When Column#scale() >0 is used on a BigDecimal , while ValueSemantics#maxFractionalDigits() is not used (<0), then Column#scale() is undersood as an alias for this annotation attribute.

default = -1 understood as unlimited

minFractionalDigits

If associated with any non-integer Number type, the minimum number of fractional digits displayed.

default = 0

dateFormatStyle

If associated with a temporal date value, the rendering style of a localized date.

timeFormatStyle

If associated with a temporal time value, the rendering style of a localized time.

timePrecision

If associated with a temporal time value, the time of day precision, used for editing a time field in the UI.default = TimePrecision#SECOND

timeZoneTranslation

If associated with a temporal value, that has time-zone or time-offset information, the rendering mode, as to whether to transform the rendered value to the user’s local/current time-zone or not.

default = TimeZoneTranslation#TO_LOCAL_TIMEZONE

dateRenderAdjustDays

If associated with a date or date-time value, instructs whether the date should be rendered as n days after the actually stored date. For negative n its days before respectively.

This is intended to be used so that an exclusive end date of an interval can be rendered as 1 day before the actual value stored.

For example:

public LocalDate getStartDate() { ... }

@ValueSemantics(dateRenderAdjustDays = ValueSemantics.AS_DAY_BEFORE)
public LocalDate getEndDate() { ... }

Here, the interval of the [1-may-2013,1-jun-2013) would be rendered as the dates 1-may-2013 for the start date but using 31-may-2013 (the day before) for the end date. What is stored In the domain object, itself, however, the value stored is 1-jun-2013.