public final class SoyMsgBundleCompactor extends Object
Important: Only use this class from message plugins!
This instance will canonicalize different parts of messages to avoid storing the same objects in memory multiple times, at the expense of static use of memory.
By using the static factory methods in this class, you ensure that message related objects are not duplicated in memory, at the cost of having one copy that cannot be garbage collected.
This saves an enormous amount of memory, especially since in gender/plural messages, there are many repeated parts.
Constructor and Description |
---|
SoyMsgBundleCompactor() |
Modifier and Type | Method and Description |
---|---|
SoyMsgBundle |
compact(SoyMsgBundle input)
Returns a more memory-efficient version of the internal message bundle.
|
public SoyMsgBundle compact(SoyMsgBundle input)
Only enough information is retained for rendering; not enough for message extraction. As a side effect, this SoyMsgBundleCompactor instance will also retain references to parts of the messages in order to reuse identical objects.