Annotation Type Messages.Offset

Enclosing interface:
Messages

@Retention(RUNTIME) @Target(PARAMETER) public static @interface Messages.Offset
Ignored except on parameters also tagged with Messages.PluralCount, and provides an offset to be subtracted from the value before a plural rule is chosen or the value is formatted. Note that "=n" forms are evaluated before this offset is applied.

Example:

   @PluralText({"=0", "No one has recommended this movie",
     "=1", "{0} has recommended this movie",
     "=2", "{0} and {1} have recommended this movie",
     "one", "{0}, {1} and one other have recommended this movie"})
   @DefaultMessage("{0}, {1} and {2,number} others have recommended this movie")
   String recommenders(@Optional String rec1, @Optional String rec2,
     @PluralCount @Offset(2) int count);
 
would result in
 recommenders("John", null, 1) => "John has..."
 recommenders("John", "Jane", 3) => "John, Jane, and one other..."
 recommenders("John", "Jane", 1402) => "John, Jane, and 1,400 others..."
 

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
     
  • Element Details

    • value

      int value