Interface JsMessageDefinition


public interface JsMessageDefinition
Container class that holds a JsMessage and information about the goog.getMsg() call it was built from.
  • Method Summary

    Modifier and Type
    Method
    Description
    The JsMessage object built from the `goog.getMsg()` call.
    The RHS node of the message assignment statement.
    com.google.common.collect.ImmutableMap<String,Node>
    A map from placehlolder name to the Node assigned to it in the values map argument of `goog.getMsg()`.
    @Nullable Node
    The object literal Node that maps placeholder names to expressions providing their values.
    The Node representing the message text template.
    boolean
    The value of the 'html' options key in the options bag argument.
    boolean
    The value of the 'unescapeHtmlEntities' options key in the options bag argument.
  • Method Details

    • getMessage

      JsMessage getMessage()
      The JsMessage object built from the `goog.getMsg()` call.
    • getMessageNode

      Node getMessageNode()
      The RHS node of the message assignment statement.

      e.g. The goog.getMsg() call in:

      
         const MSG_HELLO =
             goog.getMsg(
                 'Hello, {$name}.',
                 { 'name', getName() },
                 { unescapeHtmlEntities: true });
       
    • getTemplateTextNode

      Node getTemplateTextNode()
      The Node representing the message text template.

      This node may be a literal string or a concatenation of literal strings.

      For a goog.getMsg() call this is the first argument.

    • getPlaceholderValuesNode

      @Nullable Node getPlaceholderValuesNode()
      The object literal Node that maps placeholder names to expressions providing their values.

      This value will be null if the message definition didn't specify placeholder values.

    • getPlaceholderValueMap

      com.google.common.collect.ImmutableMap<String,Node> getPlaceholderValueMap()
      A map from placehlolder name to the Node assigned to it in the values map argument of `goog.getMsg()`.

      This will be an empty map if there was no object or it was an empty object literal.

    • shouldEscapeLessThan

      boolean shouldEscapeLessThan()
      The value of the 'html' options key in the options bag argument.

      This value will be false if there was no options bag argument, or if it didn't contain an 'html' property.

    • shouldUnescapeHtmlEntities

      boolean shouldUnescapeHtmlEntities()
      The value of the 'unescapeHtmlEntities' options key in the options bag argument.

      This value will be false if there was no options bag argument, or if it didn't contain an 'unescapeHtmlEntities' property.