当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableMap.builder方法代码示例

本文整理汇总了Java中org.trimou.util.ImmutableMap.builder方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap.builder方法的具体用法?Java ImmutableMap.builder怎么用?Java ImmutableMap.builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.trimou.util.ImmutableMap的用法示例。


在下文中一共展示了ImmutableMap.builder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Template

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
/**
 *
 * @param generatedId
 * @param name
 * @param engine
 * @param nestedTemplates
 */
public Template(Long generatedId, String name, MustacheEngine engine,
        List<Template> nestedTemplates) {
    this.generatedId = generatedId;
    this.name = name;
    this.engine = engine;
    this.globalExecutionContext = ExecutionContexts
            .newGlobalExecutionContext(engine.getConfiguration());
    if (nestedTemplates == null || nestedTemplates.isEmpty()) {
        this.nestedTemplates = Collections.emptyMap();
    } else {
        ImmutableMapBuilder<String, Template> builder = ImmutableMap
                .builder();
        for (Template template : nestedTemplates) {
            builder.put(template.getName(), template);
        }
        this.nestedTemplates = builder.build();
    }
}
 
开发者ID:trimou,项目名称:trimou,代码行数:26,代码来源:Template.java

示例2: getMap

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
@Override
protected Map<String, Object> getMap(Options options) {
    ImmutableMapBuilder<String, Object> builder = ImmutableMap.builder();
    for (Entry<String, Object> entry : options.getHash().entrySet()) {
        if (entry.getValue() instanceof String) {
            // String is expected to be an EL expression
            builder.put(entry.getKey(), Expressions.eval(entry.getValue().toString(), options, configuration));
        } else {
            builder.put(entry.getKey(), entry.getValue());
        }
    }
    return builder.build();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:14,代码来源:ELSetHelper.java

示例3: getData

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
/**
 *
 * @return all collected data
 */
public Map<String, Map<Long, Long>> getData() {
    if (data.size() == 0) {
        return Collections.emptyMap();
    }
    ImmutableMapBuilder<String, Map<Long, Long>> builder = ImmutableMap
            .builder();
    for (Entry<String, ComputingCache<Long, AtomicLong>> entry : data
            .getAllPresent().entrySet()) {
        builder.put(entry.getKey(),
                getImmutableTemplateData(entry.getValue()));
    }
    return builder.build();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:18,代码来源:SimpleStatsCollector.java

示例4: getImmutableTemplateData

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
private Map<Long, Long> getImmutableTemplateData(
        ComputingCache<Long, AtomicLong> templateData) {
    ImmutableMapBuilder<Long, Long> builder = ImmutableMap.builder();
    for (Entry<Long, AtomicLong> entry : templateData.getAllPresent()
            .entrySet()) {
        builder.put(entry.getKey(), entry.getValue().get());
    }
    return builder.build();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:10,代码来源:SimpleStatsCollector.java

示例5: getAllPresent

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
@Override
public Map<K, V> getAllPresent() {
    ImmutableMapBuilder<K, V> builder = ImmutableMap.builder();
    for (Entry<K, CacheEntry<V>> entry : map.entrySet()) {
        if (!entry.getValue().isExpired(expirationTimeout)) {
            builder.put(entry.getKey(), entry.getValue().value);
        }
    }
    return builder.build();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:11,代码来源:DefaultComputingCacheFactory.java

示例6: HelpersBuilder

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
private HelpersBuilder() {
    this.builder = ImmutableMap.builder();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:4,代码来源:HelpersBuilder.java

示例7: from

import org.trimou.util.ImmutableMap; //导入方法依赖的package包/类
/**
 *
 * @param name
 * @param configuration
 * @param segment
 * @return a handler for the given name or <code>null</code> if no such
 *         helper exists
 */
static HelperExecutionHandler from(String name, MustacheEngine engine,
        HelperAwareSegment segment) {

    // Split the name and detect unterminated literals
    Iterator<String> parts = splitHelperName(name, segment);

    Helper helper = engine.getConfiguration().getHelpers()
            .get(parts.next());

    if (helper == null) {
        // No helper with the given name found
        return null;
    }

    ImmutableListBuilder<Object> params = ImmutableList.builder();
    ImmutableMapBuilder<String, Object> hash = ImmutableMap.builder();
    LiteralSupport literalSupport = engine.getConfiguration()
            .getLiteralSupport();

    while (parts.hasNext()) {
        // Next part is a param or a hash entry
        String part = parts.next();
        if (Strings.isListLiteral(part)) {
            params.add(new ListValuePlaceholder(part, engine,
                    literalSupport, segment));
        } else {
            int equalsPosition = getFirstDeterminingEqualsCharPosition(
                    part);
            if (equalsPosition != -1) {
                String value = part.substring(equalsPosition + 1,
                        part.length());
                if (Strings.isListLiteral(value)) {
                    hash.put(part.substring(0, equalsPosition),
                            new ListValuePlaceholder(value, engine,
                                    literalSupport, segment));
                } else {
                    hash.put(part.substring(0, equalsPosition),
                            getLiteralOrPlaceholder(value, engine, segment,
                                    literalSupport));
                }
            } else {
                params.add(getLiteralOrPlaceholder(part, engine, segment,
                        literalSupport));
            }
        }
    }

    OptionsBuilder optionsBuilder = new OptionsBuilder(params.build(),
            hash.build(), segment, engine);

    // Let the helper validate the tag definition
    helper.validate(optionsBuilder);

    return new HelperExecutionHandler(helper, optionsBuilder);
}
 
开发者ID:trimou,项目名称:trimou,代码行数:64,代码来源:HelperExecutionHandler.java


注:本文中的org.trimou.util.ImmutableMap.builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。