本文整理汇总了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();
}
示例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();
}
示例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);
}