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


Java Metainf类代码示例

本文整理汇总了Java中org.immutables.metainf.Metainf的典型用法代码示例。如果您正苦于以下问题:Java Metainf类的具体用法?Java Metainf怎么用?Java Metainf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: useProvidedTypesForServices

import org.immutables.metainf.Metainf; //导入依赖的package包/类
private Set<String> useProvidedTypesForServices(TypeElement typeElement, ImmutableList<TypeMirror> typesMirrors) {
  List<String> wrongTypes = Lists.newArrayList();
  List<String> types = Lists.newArrayList();
  for (TypeMirror typeMirror : typesMirrors) {
    if (typeMirror.getKind() != TypeKind.DECLARED
        || !processing().getTypeUtils().isAssignable(typeElement.asType(), typeMirror)) {
      wrongTypes.add(typeMirror.toString());
    } else {
      types.add(typeMirror.toString());
    }
  }

  if (!wrongTypes.isEmpty()) {
    processing().getMessager().printMessage(
        Diagnostic.Kind.ERROR,
        "@Metainf.Service(value = {...}) contains types that are not implemented by "
            + typeElement.getSimpleName()
            + ": " + wrongTypes,
        typeElement,
        AnnotationMirrors.findAnnotation(typeElement.getAnnotationMirrors(), Metainf.Service.class));
  }

  return FluentIterable.from(types).toSet();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:Metaservices.java

示例2: allMetaservices

import org.immutables.metainf.Metainf; //导入依赖的package包/类
ListMultimap<String, String> allMetaservices() {
  ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();

  for (Element element : round().getElementsAnnotatedWith(Metainf.Service.class)) {
    @Nullable TypeElement typeElement = validated(element);
    if (typeElement == null) {
      continue;
    }
    Set<String> interfaceNames = extractServiceInterfaceNames(typeElement);
    String binaryName = processing().getElementUtils().getBinaryName(typeElement).toString();
    builder.putAll(binaryName, interfaceNames);
  }

  return builder.build();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:Metaservices.java

示例3: extractServiceInterfaceNames

import org.immutables.metainf.Metainf; //导入依赖的package包/类
private Set<String> extractServiceInterfaceNames(TypeElement typeElement) {
  ImmutableList<TypeMirror> typesMirrors =
      AnnotationMirrors.getTypesFromMirrors(
          Metainf.Service.class.getCanonicalName(), "value", typeElement.getAnnotationMirrors());

  if (typesMirrors.isEmpty()) {
    return useIntrospectedInterfacesForServices(typeElement);
  }

  return useProvidedTypesForServices(typeElement, typesMirrors);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:Metaservices.java


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