Package com.google.common.css
Class SimpleSubstitutionMap
- java.lang.Object
-
- com.google.common.css.SimpleSubstitutionMap
-
- All Implemented Interfaces:
SubstitutionMap
public class SimpleSubstitutionMap extends java.lang.Object implements SubstitutionMap
A SubstitutionMap that trivially renames its CSS classes by adding an underscore. This may be helpful in debugging because it makes it easy to match the renamed value with the original while helping catch bugs where the CSS class name is hardcoded in the code. Example in Soy:// Case I: Hardcoded name (incorrect) <div class="CSS_MENU_BAR"></div> // Case II: Name used as variable (correct) <div class="{css CSS_MENU_BAR}"></div>In Case I, the div would not get the effects of the CSS class when it is renamed, so hopefully the missing styles would help discover the source of the error.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.common.css.SubstitutionMap
SubstitutionMap.Initializable
-
-
Constructor Summary
Constructors Constructor Description SimpleSubstitutionMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringget(java.lang.String key)Gets the string that should be substituted forkey.
-
-
-
Method Detail
-
get
public java.lang.String get(java.lang.String key)
Gets the string that should be substituted forkey. The same value must be consistently returned for any particularkey, and the returned value must not be returned for any otherkeyvalue.- Specified by:
getin interfaceSubstitutionMap- Parameters:
key- the text to be replaced (never null)- Returns:
- the value to substitute for
key - Throws:
java.lang.IllegalArgumentException- if key is null
-
-