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


Java ImmutableClassToInstanceMap.copyOf方法代码示例

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


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

示例1: ImmutableOptionRegistry

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
private <T1 extends Option<T1>> ImmutableOptionRegistry(Collection<T> options) {
    /*
     * we first have to create a mutable map, because the collection might contain options of the same class, where
     * later ones will override previous ones. This would not be allowed by the builder of the immutable map.
     */
    ClassToInstanceMap<T> mutableOptions = MutableClassToInstanceMap.create();
    addToMap(mutableOptions, options);
    this.options = ImmutableClassToInstanceMap.copyOf(mutableOptions);
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:10,代码来源:ImmutableOptionRegistry.java

示例2: create

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
static PlaceholderMethod create(
    CharSequence name,
    UType returnType,
    ImmutableMap<UVariableDecl, ImmutableClassToInstanceMap<Annotation>> parameters,
    ClassToInstanceMap<Annotation> annotations) {
  final boolean allowsIdentity = annotations.getInstance(Placeholder.class).allowsIdentity();
  final Class<? extends Matcher<? super ExpressionTree>> matchesClass =
      annotations.containsKey(Matches.class)
          ? UTemplater.getValue(annotations.getInstance(Matches.class))
          : null;
  final Class<? extends Matcher<? super ExpressionTree>> notMatchesClass =
      annotations.containsKey(NotMatches.class)
          ? UTemplater.getValue(annotations.getInstance(NotMatches.class))
          : null;
  final Predicate<Tree.Kind> allowedKinds =
      annotations.containsKey(OfKind.class)
          ? Predicates.<Tree.Kind>in(Arrays.asList(annotations.getInstance(OfKind.class).value()))
          : Predicates.<Tree.Kind>alwaysTrue();
  class PlaceholderMatcher implements Serializable, Matcher<ExpressionTree> {

    @Override
    public boolean matches(ExpressionTree t, VisitorState state) {
      try {
        return (allowsIdentity || !(t instanceof PlaceholderParamIdent))
            && (matchesClass == null || matchesClass.newInstance().matches(t, state))
            && (notMatchesClass == null || !notMatchesClass.newInstance().matches(t, state))
            && allowedKinds.apply(t.getKind());
      } catch (InstantiationException | IllegalAccessException e) {
        throw new RuntimeException(e);
      }
    }
  }
  return new AutoValue_PlaceholderMethod(
      StringName.of(name),
      returnType,
      parameters,
      new PlaceholderMatcher(),
      ImmutableClassToInstanceMap.<Annotation, Annotation>copyOf(annotations));
}
 
开发者ID:google,项目名称:error-prone,代码行数:40,代码来源:PlaceholderMethod.java

示例3: BrokerImpl

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
public BrokerImpl(final DOMRpcService rpcService, final DOMRpcProviderService rpcProvider,
        final ClassToInstanceMap<BrokerService> services) {
    this.rpcService = Preconditions.checkNotNull(rpcService, "DOMRpcService must not be null");
    this.rpcProvider = Preconditions.checkNotNull(rpcProvider, "DOMRpcProviderService must not be null");
    this.services = ImmutableClassToInstanceMap.copyOf(services);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:BrokerImpl.java

示例4: SimpleDOMMountPoint

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
private SimpleDOMMountPoint(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
    this.identifier = identifier;
    this.services = ImmutableClassToInstanceMap.copyOf(services);
    this.schemaContext = ctx;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:SimpleDOMMountPoint.java

示例5: CloudataConnector

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
public CloudataConnector(StructuredStore store, Map<Class<?>, ?> services) {
    this.store = store;
    this.services = ImmutableClassToInstanceMap.copyOf(services);
}
 
开发者ID:justinsb,项目名称:cloudata,代码行数:5,代码来源:CloudataConnector.java

示例6: of

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
/**
 * Creates a new service context using the provided map to populate the service registry.
 * 
 * @param services  a map of type to service-providing objects, not null
 * @return a populated service context, not null
 */
public static ServiceContext of(Map<Class<?>, Object> services) {
  ArgumentChecker.noNulls(services, "services");
  return new ServiceContext(ImmutableClassToInstanceMap.copyOf(services));
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:ServiceContext.java


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