Example usage for com.google.common.css SubstitutionMap get

List of usage examples for com.google.common.css SubstitutionMap get

Introduction

In this page you can find the example usage for com.google.common.css SubstitutionMap get.

Prototype

String get(String key);

Source Link

Document

Gets the string that should be substituted for key .

Usage

From source file:com.google.gwt.resources.rg.GssResourceGenerator.java

private Map<String, String> computeReplacementsForType(JClassType cssResource) {
    Map<String, String> replacements = replacementsByClassAndMethod.get(cssResource);

    if (replacements == null) {
        replacements = new HashMap<String, String>();
        replacementsByClassAndMethod.put(cssResource, replacements);

        String resourcePrefix = resourcePrefixBuilder.get(cssResource.getQualifiedSourceName());

        // This substitution map will prefix each renamed class with the resource prefix and use a
        // MinimalSubstitutionMap for computing the obfuscated name.
        SubstitutionMap prefixingSubstitutionMap = new PrefixingSubstitutionMap(new MinimalSubstitutionMap(),
                obfuscationPrefix + resourcePrefix + "-");

        for (JMethod method : cssResource.getOverridableMethods()) {
            if (method == getNameMethod || method == getTextMethod || method == ensuredInjectedMethod) {
                continue;
            }//from   w  ww  .j av  a 2 s.  c  o  m

            String styleClass = getClassName(method);

            if (replacementsForSharedMethods.containsKey(method)) {
                replacements.put(styleClass, replacementsForSharedMethods.get(method));
            } else {
                String obfuscatedClassName = prefixingSubstitutionMap.get(styleClass);
                String replacement = obfuscationStyle.getPrettyName(styleClass, cssResource,
                        obfuscatedClassName);

                replacements.put(styleClass, replacement);
                maybeHandleSharedMethod(method, replacement);
            }
        }
    }

    return replacements;
}