Package com.google.javascript.jscomp

# Class JsMessage.Builder

java.lang.Object
com.google.javascript.jscomp.JsMessage.Builder

Enclosing class:
  `JsMessage`

public static class JsMessage.Builder extends Object
Contains functionality for creating JS messages. Generates authoritative keys and fingerprints for a message that must stay constant over time. This implementation correctly processes unnamed messages and creates a key for them that looks like MSG_<fingerprint value>.

## Constructor Summary

Constructors
Constructor
Description
`Builder()`
`Builder(String key)`
Creates an instance.

## Method Summary

Modifier and Type
Method
Description
`JsMessage.Builder`
`appendPlaceholderReference(String name)`
Appends a placeholder reference to the message
`JsMessage.Builder`
`appendStringPart(String part)`
Appends a translatable string literal to the message.
`JsMessage`
`build()`
`JsMessage`
`build(JsMessage.IdGenerator idGenerator)`
`String`
`getKey()`
Gets the message's key (e.g.
`List<CharSequence>`
`getParts()`
`Set<String>`
`getPlaceholders()`
Returns the message registered placeholders
`boolean`
`hasParts()`
Gets whether at least one part has been appended.
`JsMessage.Builder`
`setDesc(String desc)`
Sets the description of the message, which helps translators.
`JsMessage.Builder`
`setIsHidden(boolean hidden)`
Sets whether the message should be hidden from volunteer translators.
`JsMessage.Builder`
`setKey(String key)`
`JsMessage.Builder`
`setMeaning(String meaning)`
Sets the programmer-specified meaning of this message, which forces this message to translate differently.
`JsMessage.Builder`
`setSourceName(String sourceName)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Builder

public Builder()

### Builder

public Builder(String key)
Creates an instance.

## Method Details

### getKey

public String getKey()
Gets the message's key (e.g. `"MSG_HELLO"`).

### setKey

public JsMessage.Builder setKey(String key)

Parameters:
  `key` - a key that should uniquely identify this message; typically it is the message's name (e.g. `"MSG_HELLO"`).

### setSourceName

public JsMessage.Builder setSourceName(String sourceName)

Parameters:
  `sourceName` - The message's sourceName.

### appendPlaceholderReference

public JsMessage.Builder appendPlaceholderReference(String name)
Appends a placeholder reference to the message

### appendStringPart

public JsMessage.Builder appendStringPart(String part)
Appends a translatable string literal to the message.

### getPlaceholders

public Set<String> getPlaceholders()
Returns the message registered placeholders

### setDesc

public JsMessage.Builder setDesc(String desc)
Sets the description of the message, which helps translators.

### setMeaning

public JsMessage.Builder setMeaning(String meaning)
Sets the programmer-specified meaning of this message, which forces this message to translate differently.

### setIsHidden

public JsMessage.Builder setIsHidden(boolean hidden)
Sets whether the message should be hidden from volunteer translators.

### hasParts

public boolean hasParts()
Gets whether at least one part has been appended.

### getParts

public List<CharSequence> getParts()

### build

public JsMessage build()

### build

public JsMessage build(JsMessage.IdGenerator idGenerator)