當前位置: 首頁>>代碼示例>>Java>>正文


Java MinimalSubstitutionMap類代碼示例

本文整理匯總了Java中com.google.common.css.MinimalSubstitutionMap的典型用法代碼示例。如果您正苦於以下問題:Java MinimalSubstitutionMap類的具體用法?Java MinimalSubstitutionMap怎麽用?Java MinimalSubstitutionMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MinimalSubstitutionMap類屬於com.google.common.css包,在下文中一共展示了MinimalSubstitutionMap類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: StableCssSubstitutionMapProvider

import com.google.common.css.MinimalSubstitutionMap; //導入依賴的package包/類
/**
 * @param backingFile a file that need not exist, but if it does, contains
 *     the content of the renaming map as formatted by
 *     {@link OutputRenamingMapFormat#JSON}..
 */
public StableCssSubstitutionMapProvider(File backingFile)
throws IOException {
  CharSource renameMapJson = Files.asCharSource(backingFile, Charsets.UTF_8);
  RecordingSubstitutionMap.Builder substitutionMapBuilder =
      new RecordingSubstitutionMap.Builder()
      .withSubstitutionMap(
          new MinimalSubstitutionMap());
  ImmutableMap<String, String> mappings = ImmutableMap.of();
  try {
    try (Reader reader = renameMapJson.openBufferedStream()) {
      mappings = OutputRenamingMapFormat.JSON.readRenamingMap(reader);
    }
  } catch (@SuppressWarnings("unused") FileNotFoundException ex) {
    // Ok.  Start with an empty map.
  }

  substitutionMapBuilder.withMappings(mappings);

  this.substitutionMap = substitutionMapBuilder.build();
  this.backingFile = backingFile;
  this.originalMappings = mappings;
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:28,代碼來源:StableCssSubstitutionMapProvider.java

示例2: testMapWithTypeMinimal

import com.google.common.css.MinimalSubstitutionMap; //導入依賴的package包/類
@Test
public void testMapWithTypeMinimal() {
  RecordingSubstitutionMap map =
      new RecordingSubstitutionMap.Builder()
          .withSubstitutionMap(new MinimalSubstitutionMap())
          .shouldRecordMappingForCodeGeneration(predicate)
          .build();
  setupWithMap(map);
  assertThat(mappings).hasSize(1);
  assertThat(mappings.get("CSS_SPRITE").length()).isEqualTo(1);
}
 
開發者ID:google,項目名稱:closure-stylesheets,代碼行數:12,代碼來源:RecordingSubstitutionMapTest.java

示例3: computeReplacementsForType

import com.google.common.css.MinimalSubstitutionMap; //導入依賴的package包/類
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;
      }

      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;
}
 
開發者ID:jDramaix,項目名稱:gss.gwt,代碼行數:37,代碼來源:GssResourceGenerator.java


注:本文中的com.google.common.css.MinimalSubstitutionMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。