當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。