当前位置: 首页>>代码示例>>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;未经允许,请勿转载。