org.apache.shindig.gadgets.spec
Class GadgetSpec

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

public class GadgetSpec
extends Object

Represents a gadget specification root element (Module).

See Also:
gadgets spec

Field Summary
static Locale DEFAULT_LOCALE
           
static String DEFAULT_VIEW
           
 
Constructor Summary
GadgetSpec(Uri url, Element doc, String original)
          Creates a new Module from the given xml input.
GadgetSpec(Uri url, String xml)
          Use for testing.
 
Method Summary
 Object getAttribute(String key)
           
 String getChecksum()
           
 ModulePrefs getModulePrefs()
           
 Uri getUrl()
           
 Map<String,UserPref> getUserPrefs()
           
 View getView(String name)
          Retrieves a single view by name.
 Map<String,View> getViews()
           
 void setAttribute(String key, Object o)
          Sets an attribute on the gadget spec.
 GadgetSpec substitute(Substitutions substituter)
          Performs substitutions on the spec.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VIEW

public static final String DEFAULT_VIEW
See Also:
Constant Field Values

DEFAULT_LOCALE

public static final Locale DEFAULT_LOCALE
Constructor Detail

GadgetSpec

public GadgetSpec(Uri url,
                  Element doc,
                  String original)
           throws SpecParserException
Creates a new Module from the given xml input.

Parameters:
url - The original url of the gadget.
doc - The pre-parsed xml document.
original - Unparsed input XML. Used to generate checksums.
Throws:
SpecParserException - If xml can not be processed as a valid gadget spec.

GadgetSpec

public GadgetSpec(Uri url,
                  String xml)
           throws SpecParserException
Use for testing.

Throws:
SpecParserException
Method Detail

getUrl

public Uri getUrl()

getChecksum

public String getChecksum()

getModulePrefs

public ModulePrefs getModulePrefs()

getUserPrefs

public Map<String,UserPref> getUserPrefs()

getViews

public Map<String,View> getViews()

getView

public View getView(String name)
Retrieves a single view by name.

Parameters:
name - The name of the view you want to see
Returns:
The view object, if it exists, or null.

getAttribute

public Object getAttribute(String key)

setAttribute

public void setAttribute(String key,
                         Object o)
Sets an attribute on the gadget spec. This should only be done during a constructing phase, as a GadgetSpec should be effectively immutable after it is constructed.

Parameters:
key - The attribute name.
o - The value of the attribute.

substitute

public GadgetSpec substitute(Substitutions substituter)
Performs substitutions on the spec. See individual elements for details on what gets substituted.

Parameters:
substituter -
Returns:
The substituted spec.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2012. All Rights Reserved.