Annotation Type MessageBundle


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @interface MessageBundle
    Denotes a message bundle interface.

    Each method represents a single message:

     
     @MessageBundle
     interface MyBundle {
    
         @Message("Hello {name}!")
         String hello_world(String name);
     }
     
     
    • Field Detail

      • DEFAULT_LOCALE

        static final String DEFAULT_LOCALE
        Constant value for locale() indicating that the default locale specified via the quarkus.default-locale config property should be used.
      • DEFAULT_NAME

        static final String DEFAULT_NAME
        Constant value for value().
      • DEFAULTED_NAME

        static final String DEFAULTED_NAME
        Constant value for value() indicating that the name should be defaulted.

        For a top-level class the "msg" is used.

        For a nested class the name consists of the simple names of all enclosing classes in the hierarchy (top-level class goes first), followed by the simple name of the message bundle interface. Names are separated by underscores. For example, the name of the following message bundle will be defaulted to Controller_index and it could be used in a template via {Controller_index:hello(name)}:

         
         class Controller {
        
            @MessageBundle
            interface index {
        
               @Message("Hello {name}!")
               String hello(String name);
            }
         }
         
         
    • Element Detail

      • value

        String value
        The name is used as a namespace in templates expressions - {msg:hello_world}, and as a part of the name of a message bundle localized file - msg_de.properties.

        If multiple bundles declare the same name then the build fails.

        Returns:
        the name of the bundle
        Default:
        "<<defaulted name>>"
      • locale

        String locale
        The language tag (IETF) of the default locale.
        Returns:
        the locale for the default message bundle
        See Also:
        Locale.forLanguageTag(String)
        Default:
        "<<default locale>>"