org.apache.shindig.gadgets.variables
Class Substitutions

java.lang.Object
  extended by org.apache.shindig.gadgets.variables.Substitutions

public class Substitutions
extends Object

Performs string substitutions for message bundles, user prefs, and bidi variables.


Nested Class Summary
static class Substitutions.Type
          Defines all of the valid types of message substitutions.
 
Constructor Summary
Substitutions()
           
 
Method Summary
 void addSubstitution(Substitutions.Type type, String key, String value)
          Adds a new substitution for the given type.
 void addSubstitutions(Substitutions.Type type, Map<String,String> entries)
          Adds many substitutions of the same type at once.
 String getSubstitution(Substitutions.Type type, String key)
           
 String substituteString(String input)
          Performs string substitution only for the specified type.
 Uri substituteUri(Uri uri)
          Substitutes a uri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Substitutions

public Substitutions()
Method Detail

addSubstitution

public void addSubstitution(Substitutions.Type type,
                            String key,
                            String value)
Adds a new substitution for the given type.

Parameters:
type -
key -
value -

getSubstitution

public String getSubstitution(Substitutions.Type type,
                              String key)
Returns:
The value stored for the given type and key, or null.

addSubstitutions

public void addSubstitutions(Substitutions.Type type,
                             Map<String,String> entries)
Adds many substitutions of the same type at once.

Parameters:
type -
entries -

substituteString

public String substituteString(String input)
Performs string substitution only for the specified type. If no substitution for input was provided or input is null, the output is left untouched.

Parameters:
input - The base string, with substitution markers.
Returns:
The substituted string.

substituteUri

public Uri substituteUri(Uri uri)
Substitutes a uri

Parameters:
uri -
Returns:
The substituted uri, or a dummy value if the result is invalid.


Copyright © 2007-2012. All Rights Reserved.