Package com.google.javascript.jscomp
Interface JsMessage.Part
- All Known Implementing Classes:
JsMessage.PlaceholderReference
,JsMessage.StringPart
- Enclosing class:
JsMessage
public static interface JsMessage.Part
Represents part of a message.
-
Method Summary
Modifier and TypeMethodDescriptionGets the name of the placeholder as it would appear in XMB or XTB files, and also the form it takes when generating message IDs.Gets the name of the placeholder as it would appear in JS code.Gets the literal string for this message part.boolean
True for placeholders, false for literal string parts.
-
Method Details
-
isPlaceholder
boolean isPlaceholder()True for placeholders, false for literal string parts. -
getJsPlaceholderName
String getJsPlaceholderName()Gets the name of the placeholder as it would appear in JS code.In JS code placeholders are in lower camel case with zero or more trailing numeric suffixes (e.g. myPlaceholderName_123_456).
- Returns:
- the name for a placeholder
- Throws:
UnsupportedOperationException
- if this is not aJsMessage.PlaceholderReference
.
-
getCanonicalPlaceholderName
String getCanonicalPlaceholderName()Gets the name of the placeholder as it would appear in XMB or XTB files, and also the form it takes when generating message IDs.This format is UPPER_SNAKE_CASE.
- Returns:
- the name for a placeholder
- Throws:
UnsupportedOperationException
- if this is not aJsMessage.PlaceholderReference
.
-
getString
String getString()Gets the literal string for this message part.- Returns:
- the literal string for
JsMessage.StringPart
. - Throws:
UnsupportedOperationException
- if this is not aJsMessage.StringPart
.
-