org.apache.shindig.gadgets.spec
Class MessageBundle

java.lang.Object
  extended by org.apache.shindig.gadgets.spec.MessageBundle

public class MessageBundle
extends Object

Represents a messagebundle structure.


Field Summary
static MessageBundle EMPTY
           
 
Constructor Summary
MessageBundle(Element element)
          Constructs a message bundle from a /ModulePrefs/Locale with nested messages.
MessageBundle(LocaleSpec locale, Map<String,String> map)
          Constructs a message bundle from a prebuilt map.
MessageBundle(LocaleSpec locale, String xml)
          Constructs a message bundle from input xml (fetched from an external file).
MessageBundle(MessageBundle... bundles)
          Create a MessageBundle by merging multiple bundles together.
 
Method Summary
 String getLanguageDirection()
           
 Map<String,String> getMessages()
           
 String toJSONString()
          Return the message bundle contents as a JSON encoded string.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final MessageBundle EMPTY
Constructor Detail

MessageBundle

public MessageBundle(LocaleSpec locale,
                     String xml)
              throws SpecParserException
Constructs a message bundle from input xml (fetched from an external file).

Parameters:
locale - The LocaleSpec element that this bundle was constructed from.
xml - The content of the remote file.
Throws:
SpecParserException - if parsing fails.

MessageBundle

public MessageBundle(LocaleSpec locale,
                     Map<String,String> map)
Constructs a message bundle from a prebuilt map.

Parameters:
locale - The LocaleSpec element that this bundle was constructed from.
map - The content of the message map.

MessageBundle

public MessageBundle(Element element)
              throws SpecParserException
Constructs a message bundle from a /ModulePrefs/Locale with nested messages.

Parameters:
element - XML Dom element to parse
Throws:
SpecParserException - when badly formed xml is provided

MessageBundle

public MessageBundle(MessageBundle... bundles)
Create a MessageBundle by merging multiple bundles together.

Parameters:
bundles - the bundles to merge, in order
Method Detail

getLanguageDirection

public String getLanguageDirection()
Returns:
The language direction associated with this message bundle, derived from the LocaleSpec element that the bundle was constructed from.

getMessages

public Map<String,String> getMessages()
Returns:
A read-only view of the message bundle.

toJSONString

public String toJSONString()
Return the message bundle contents as a JSON encoded string.

Returns:
json representation of the message bundler

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2012. All Rights Reserved.