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


Java ImmutableClassToInstanceMap.builder方法代码示例

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


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

示例1: annotationMap

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static ImmutableClassToInstanceMap<Annotation> annotationMap(Symbol symbol) {
  ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder();
  for (Compound compound : symbol.getAnnotationMirrors()) {
    Name qualifiedAnnotationType =
        ((TypeElement) compound.getAnnotationType().asElement()).getQualifiedName();
    try {
      Class<? extends Annotation> annotationClazz = 
          Class.forName(qualifiedAnnotationType.toString()).asSubclass(Annotation.class);
      builder.put((Class) annotationClazz,
          AnnotationProxyMaker.generateAnnotation(compound, annotationClazz));
    } catch (ClassNotFoundException e) {
      throw new IllegalArgumentException("Unrecognized annotation type", e);
    }
  }
  return builder.build();
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:18,代码来源:UTemplater.java

示例2: annotationMap

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static ImmutableClassToInstanceMap<Annotation> annotationMap(Symbol symbol) {
  ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder();
  for (Compound compound : symbol.getAnnotationMirrors()) {
    Name qualifiedAnnotationType =
        ((TypeElement) compound.getAnnotationType().asElement()).getQualifiedName();
    try {
      Class<? extends Annotation> annotationClazz =
          Class.forName(qualifiedAnnotationType.toString()).asSubclass(Annotation.class);
      builder.put(
          (Class) annotationClazz,
          AnnotationProxyMaker.generateAnnotation(compound, annotationClazz));
    } catch (ClassNotFoundException e) {
      throw new IllegalArgumentException("Unrecognized annotation type", e);
    }
  }
  return builder.build();
}
 
开发者ID:google,项目名称:error-prone,代码行数:19,代码来源:UTemplater.java

示例3: start

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
public void start() {
    checkState(controllerRoot == null, "Binding Aware Broker was already started.");
    LOG.info("Starting Binding Aware Broker: {}", identifier);

    controllerRoot = new RootSalInstance(getRpcProviderRegistry(), getNotificationBroker());

    final ImmutableClassToInstanceMap.Builder<BindingAwareService> consBuilder = ImmutableClassToInstanceMap
            .builder();

    consBuilder.put(NotificationService.class, getRoot());
    consBuilder.put(RpcConsumerRegistry.class, getRoot());
    if (dataBroker != null) {
        consBuilder.put(DataBroker.class, dataBroker);
    }
    consBuilder.put(MountPointService.class, mountService);

    supportedConsumerServices = consBuilder.build();
    final ImmutableClassToInstanceMap.Builder<BindingAwareService> provBuilder = ImmutableClassToInstanceMap
            .builder();
    provBuilder.putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
            .put(RpcProviderRegistry.class, getRoot());
    if (notificationPublishService != null) {
        provBuilder.put(NotificationPublishService.class, notificationPublishService);
    }

    supportedProviderServices = provBuilder.build();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:28,代码来源:RootBindingAwareBroker.java

示例4: mapOf

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
/**
 * Creates a class to instance map, from the given coordinates. The map will contain the classes of the coordinates
 * as keys and the coordinates themselves as values. Duplicate keys (dimensions) are not allowed and will result in
 * an {@link IllegalArgumentException}.
 * 
 * @param coordinates the coordinates to be added to the map
 * @return an immutable map from dimensions (coordinate classes) to coordinate
 * @throws IllegalArgumentException if more than one coordinate per dimension are provided
 * @deprecated
 */
@Deprecated
public static <C> ClassToInstanceMap<C> mapOf(Iterable<? extends C> coordinates) {
    ImmutableClassToInstanceMap.Builder<C> coordinateBuilder = ImmutableClassToInstanceMap.builder();
    for (C coordinate : coordinates) {
        @SuppressWarnings("unchecked")
        Class<C> coordinateClass = (Class<C>) coordinate.getClass();
        coordinateBuilder.put(coordinateClass, coordinate);
    }
    return coordinateBuilder.build();
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:21,代码来源:Coordinates.java

示例5: annotations

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public ImmutableClassToInstanceMap<Annotation> annotations() {
  ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder();
  for (Annotation annotation : checker().getClass().getDeclaredAnnotations()) {
    builder.put((Class) annotation.annotationType(), annotation);
  }
  return builder.build();
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:10,代码来源:BugCheckerTransformer.java

示例6: getAttachments

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
private ImmutableClassToInstanceMap<Object> getAttachments(IStrategoTerm term) {
    Builder<Object> b = ImmutableClassToInstanceMap.builder();

    TermOrigin.get(term).ifPresent(origin -> {
        b.put(TermOrigin.class, origin);
    });

    StrategoTermIndices.get(term).ifPresent(termIndex -> {
        b.put(TermIndex.class, termIndex);
    });

    b.put(StrategoAnnotations.class, ImmutableStrategoAnnotations.of(term.getAnnotations()));

    return b.build();
}
 
开发者ID:metaborg,项目名称:nabl,代码行数:16,代码来源:StrategoTerms.java

示例7: getFieldValue

import com.google.common.collect.ImmutableClassToInstanceMap; //导入方法依赖的package包/类
/**
 * Helper method to wrap the solr doc up in a context & get the value using the field
 */
private <R> R getFieldValue(Field<R> field, SolrDocument doc) {
    ImmutableClassToInstanceMap.Builder<FieldDataSource<?>> context = ImmutableClassToInstanceMap.builder();
    context.put(SolrDocDataSource.class, new SolrDocDataSource(doc));
    return field.getValue(context.build());
}
 
开发者ID:semantico,项目名称:rigel,代码行数:9,代码来源:FieldBasedTerm.java


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