本文整理匯總了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);
}