Java Code Examples for org.jboss.jandex.ClassInfo#classAnnotation()
The following examples show how to use
org.jboss.jandex.ClassInfo#classAnnotation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestClientProcessor.java From quarkus with Apache License 2.0 | 6 votes |
private void warnAboutNotWorkingFeaturesInNative(PackageConfig packageConfig, Map<DotName, ClassInfo> interfaces) { if (!packageConfig.type.equalsIgnoreCase(PackageConfig.NATIVE)) { return; } Set<DotName> dotNames = new HashSet<>(); for (ClassInfo interfaze : interfaces.values()) { if (interfaze.classAnnotation(CLIENT_HEADER_PARAM) != null) { boolean hasDefault = false; for (MethodInfo method : interfaze.methods()) { if (isDefault(method.flags())) { hasDefault = true; break; } } if (hasDefault) { dotNames.add(interfaze.name()); } } } if (!dotNames.isEmpty()) { log.warnf("rest-client interfaces that contain default methods and are annotated with '@" + CLIENT_HEADER_PARAM + "' might not work properly in native mode. Offending interfaces are: " + dotNames.stream().map(d -> "'" + d.toString() + "'").collect(Collectors.joining(", "))); } }
Example 2
Source File: MethodNameParser.java From quarkus with Apache License 2.0 | 6 votes |
private List<ClassInfo> getMappedSuperClassInfos(IndexView indexView, ClassInfo entityClass) { List<ClassInfo> mappedSuperClassInfos = new ArrayList<>(3); Type superClassType = entityClass.superClassType(); while (superClassType != null && !superClassType.name().equals(DotNames.OBJECT)) { ClassInfo superClass = indexView.getClassByName(entityClass.superName()); if (superClass.classAnnotation(DotNames.JPA_MAPPED_SUPERCLASS) != null) { mappedSuperClassInfos.add(superClass); } if (superClassType.kind() == Kind.CLASS) { superClassType = indexView.getClassByName(superClassType.name()).superClassType(); } else if (superClassType.kind() == Kind.PARAMETERIZED_TYPE) { ParameterizedType parameterizedType = superClassType.asParameterizedType(); superClassType = parameterizedType.owner(); } } if (mappedSuperClassInfos.size() > 0) { return mappedSuperClassInfos; } return Collections.emptyList(); }
Example 3
Source File: RestClientProcessor.java From quarkus with Apache License 2.0 | 5 votes |
private String getAnnotationParameter(ClassInfo classInfo, String parameterName) { AnnotationInstance instance = classInfo.classAnnotation(REGISTER_REST_CLIENT); if (instance == null) { return ""; } AnnotationValue value = instance.value(parameterName); if (value == null) { return ""; } return value.asString(); }
Example 4
Source File: SchemaFactory.java From smallrye-open-api with Apache License 2.0 | 5 votes |
/** * Convert a Jandex enum class type to a {@link Schema} model.Adds each enum constant name to the list of the given schema's * enumeration list. * * The given type must be found in the index. * * @param index Jandex index containing the ClassInfo for the given enum type * @param enumType type containing Java Enum constants * @return Schema model * * @see java.lang.reflect.Field#isEnumConstant() */ public static Schema enumToSchema(IndexView index, Type enumType) { IoLogging.log.enumProcessing(enumType); final int ENUM = 0x00004000; // see java.lang.reflect.Modifier#ENUM ClassInfo enumKlazz = index.getClassByName(TypeUtil.getName(enumType)); AnnotationInstance schemaAnnotation = enumKlazz.classAnnotation(SchemaConstant.DOTNAME_SCHEMA); Schema enumSchema = new SchemaImpl(); List<Object> enumeration = enumKlazz.fields() .stream() .filter(field -> (field.flags() & ENUM) != 0) .map(FieldInfo::name) .sorted() // Make the order determinate .collect(Collectors.toList()); if (schemaAnnotation != null) { Map<String, Object> defaults = new HashMap<>(2); defaults.put(SchemaConstant.PROP_TYPE, SchemaType.STRING); defaults.put(SchemaConstant.PROP_ENUMERATION, enumeration); enumSchema = readSchema(index, enumSchema, schemaAnnotation, enumKlazz, defaults); } else { enumSchema.setType(SchemaType.STRING); enumSchema.setEnumeration(enumeration); } return enumSchema; }
Example 5
Source File: BeanDeployment.java From quarkus with Apache License 2.0 | 5 votes |
private static Map<DotName, ClassInfo> findContainerAnnotations(Map<DotName, ClassInfo> qualifiers, IndexView index) { Map<DotName, ClassInfo> containerAnnotations = new HashMap<>(); for (ClassInfo qualifier : qualifiers.values()) { AnnotationInstance instance = qualifier.classAnnotation(DotNames.REPEATABLE); if (instance != null) { DotName annotationName = instance.value().asClass().name(); containerAnnotations.put(annotationName, getClassByName(index, annotationName)); } } return containerAnnotations; }
Example 6
Source File: ResourcePropertiesAccessor.java From quarkus with Apache License 2.0 | 5 votes |
private AnnotationInstance getAnnotation(ClassInfo classInfo) { if (classInfo.classAnnotation(RESOURCE_PROPERTIES_ANNOTATION) != null) { return classInfo.classAnnotation(RESOURCE_PROPERTIES_ANNOTATION); } if (classInfo.superName() != null) { ClassInfo superControllerInterface = index.getClassByName(classInfo.superName()); if (superControllerInterface != null) { return getAnnotation(superControllerInterface); } } return null; }
Example 7
Source File: GrpcServerProcessor.java From quarkus with Apache License 2.0 | 5 votes |
@BuildStep void discoverBindableServices(BuildProducer<BindableServiceBuildItem> bindables, CombinedIndexBuildItem combinedIndexBuildItem) { Collection<ClassInfo> bindableServices = combinedIndexBuildItem.getIndex() .getAllKnownImplementors(GrpcDotNames.BINDABLE_SERVICE); for (ClassInfo service : bindableServices) { if (!Modifier.isAbstract(service.flags()) && service.classAnnotation(DotNames.SINGLETON) != null) { bindables.produce(new BindableServiceBuildItem(service.name())); } } }
Example 8
Source File: SpringDataJPAProcessor.java From quarkus with Apache License 2.0 | 5 votes |
private void removeNoRepositoryBeanClasses(List<ClassInfo> interfacesExtendingCrudRepository) { Iterator<ClassInfo> iterator = interfacesExtendingCrudRepository.iterator(); while (iterator.hasNext()) { ClassInfo next = iterator.next(); if (next.classAnnotation(DotNames.SPRING_DATA_NO_REPOSITORY_BEAN) != null) { iterator.remove(); } } }
Example 9
Source File: JpaJandexScavenger.java From quarkus with Apache License 2.0 | 5 votes |
private static void collectDomainObject(JpaEntitiesBuildItem domainObjectCollector, ClassInfo modelClass) { if (modelClass.classAnnotation(JPA_ENTITY) != null) { domainObjectCollector.addEntityClass(modelClass.name().toString()); } else { domainObjectCollector.addModelClass(modelClass.name().toString()); } }
Example 10
Source File: JandexBeanInfoAdapter.java From quarkus with Apache License 2.0 | 5 votes |
private Stream<AnnotationInfo> getMetricAnnotationsThroughStereotype(AnnotationInstance stereotypeInstance, IndexView indexView) { ClassInfo annotationType = indexView.getClassByName(stereotypeInstance.name()); if (annotationType.classAnnotation(DotNames.STEREOTYPE) != null) { JandexAnnotationInfoAdapter adapter = new JandexAnnotationInfoAdapter(indexView); return annotationType.classAnnotations() .stream() .filter(SmallRyeMetricsDotNames::isMetricAnnotation) .map(adapter::convert); } else { return Stream.empty(); } }
Example 11
Source File: SpringWebProcessor.java From quarkus with Apache License 2.0 | 5 votes |
/** * Make sure the controllers have the proper annotation and warn if not */ private void validateControllers(BeanArchiveIndexBuildItem beanArchiveIndexBuildItem) { Set<DotName> classesWithoutRestController = new HashSet<>(); for (DotName mappingAnnotation : MAPPING_ANNOTATIONS) { Collection<AnnotationInstance> annotations = beanArchiveIndexBuildItem.getIndex().getAnnotations(mappingAnnotation); for (AnnotationInstance annotation : annotations) { ClassInfo targetClass; if (annotation.target().kind() == AnnotationTarget.Kind.CLASS) { targetClass = annotation.target().asClass(); } else if (annotation.target().kind() == AnnotationTarget.Kind.METHOD) { targetClass = annotation.target().asMethod().declaringClass(); } else { continue; } if (targetClass.classAnnotation(REST_CONTROLLER_ANNOTATION) == null) { classesWithoutRestController.add(targetClass.name()); } } } if (!classesWithoutRestController.isEmpty()) { for (DotName dotName : classesWithoutRestController) { LOGGER.warn("Class '" + dotName + "' uses a mapping annotation but the class itself was not annotated with '@RestContoller'. The mappings will therefore be ignored."); } } }
Example 12
Source File: LiquibaseProcessor.java From quarkus with Apache License 2.0 | 4 votes |
/** * The default service loader is super slow * * As part of the extension build we index liquibase, then we use this index to find all implementations of services */ @BuildStep(onlyIfNot = NativeBuild.class) @Record(STATIC_INIT) public void fastServiceLoader(LiquibaseRecorder recorder, List<JdbcDataSourceBuildItem> jdbcDataSourceBuildItems) throws IOException { DotName liquibaseServiceName = DotName.createSimple(LiquibaseService.class.getName()); try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/liquibase.idx")) { IndexReader reader = new IndexReader(in); Index index = reader.read(); Map<String, List<String>> services = new HashMap<>(); for (Class<?> c : Arrays.asList(liquibase.diff.compare.DatabaseObjectComparator.class, liquibase.parser.NamespaceDetails.class, liquibase.precondition.Precondition.class, liquibase.database.Database.class, liquibase.parser.ChangeLogParser.class, liquibase.change.Change.class, liquibase.snapshot.SnapshotGenerator.class, liquibase.changelog.ChangeLogHistoryService.class, liquibase.datatype.LiquibaseDataType.class, liquibase.executor.Executor.class, liquibase.lockservice.LockService.class, liquibase.sqlgenerator.SqlGenerator.class, liquibase.license.LicenseService.class)) { List<String> impls = new ArrayList<>(); services.put(c.getName(), impls); Set<ClassInfo> classes = new HashSet<>(); if (c.isInterface()) { classes.addAll(index.getAllKnownImplementors(DotName.createSimple(c.getName()))); } else { classes.addAll(index.getAllKnownSubclasses(DotName.createSimple(c.getName()))); } for (ClassInfo found : classes) { if (Modifier.isAbstract(found.flags()) || Modifier.isInterface(found.flags()) || !found.hasNoArgsConstructor() || !Modifier.isPublic(found.flags())) { continue; } AnnotationInstance annotationInstance = found.classAnnotation(liquibaseServiceName); if (annotationInstance == null || !annotationInstance.value("skip").asBoolean()) { impls.add(found.name().toString()); } } } //if we know what DB types are in use we limit them //this gives a huge startup time boost //otherwise it generates SQL for every DB boolean allKnown = true; Set<String> databases = new HashSet<>(); for (JdbcDataSourceBuildItem i : jdbcDataSourceBuildItems) { String known = KIND_TO_IMPL.get(i.getDbKind()); if (known == null) { allKnown = false; } else { databases.add(known); } } if (allKnown) { services.put(Database.class.getName(), new ArrayList<>(databases)); } recorder.setJvmServiceImplementations(services); } }
Example 13
Source File: MicroProfileHealthProcessor.java From camel-quarkus with Apache License 2.0 | 4 votes |
private boolean isCamelMicroProfileHealthCheck(ClassInfo classInfo) { String className = classInfo.name().toString(); return className.startsWith(AbstractCamelMicroProfileHealthCheck.class.getPackage().getName()) && (classInfo.classAnnotation(MICROPROFILE_LIVENESS_DOTNAME) != null || classInfo.classAnnotation(MICROPROFILE_READINESS_DOTNAME) != null); }
Example 14
Source File: VertxWebProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep void validateBeanDeployment( ValidationPhaseBuildItem validationPhase, BuildProducer<AnnotatedRouteHandlerBuildItem> routeHandlerBusinessMethods, BuildProducer<AnnotatedRouteFilterBuildItem> routeFilterBusinessMethods, BuildProducer<ValidationErrorBuildItem> errors) { // Collect all business methods annotated with @Route and @RouteFilter AnnotationStore annotationStore = validationPhase.getContext().get(BuildExtension.Key.ANNOTATION_STORE); for (BeanInfo bean : validationPhase.getContext().beans().classBeans()) { // NOTE: inherited business methods are not taken into account ClassInfo beanClass = bean.getTarget().get().asClass(); AnnotationInstance routeBaseAnnotation = beanClass.classAnnotation(ROUTE_BASE); for (MethodInfo method : beanClass.methods()) { List<AnnotationInstance> routes = new LinkedList<>(); AnnotationInstance routeAnnotation = annotationStore.getAnnotation(method, ROUTE); if (routeAnnotation != null) { validateRouteMethod(bean, method, ROUTE_PARAM_TYPES); routes.add(routeAnnotation); } if (routes.isEmpty()) { AnnotationInstance routesAnnotation = annotationStore.getAnnotation(method, ROUTES); if (routesAnnotation != null) { validateRouteMethod(bean, method, ROUTE_PARAM_TYPES); Collections.addAll(routes, routesAnnotation.value().asNestedArray()); } } if (!routes.isEmpty()) { LOGGER.debugf("Found route handler business method %s declared on %s", method, bean); routeHandlerBusinessMethods .produce(new AnnotatedRouteHandlerBuildItem(bean, method, routes, routeBaseAnnotation)); } // AnnotationInstance filterAnnotation = annotationStore.getAnnotation(method, ROUTE_FILTER); if (filterAnnotation != null) { if (!routes.isEmpty()) { errors.produce(new ValidationErrorBuildItem(new IllegalStateException( String.format( "@Route and @RouteFilter cannot be declared on business method %s declared on %s", method, bean)))); } else { validateRouteMethod(bean, method, ROUTE_FILTER_TYPES); routeFilterBusinessMethods .produce(new AnnotatedRouteFilterBuildItem(bean, method, filterAnnotation)); LOGGER.debugf("Found route filter business method %s declared on %s", method, bean); } } } } }
Example 15
Source File: SpringWebProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep(onlyIf = IsDevelopment.class) @Record(STATIC_INIT) public void registerWithDevModeNotFoundMapper(BeanArchiveIndexBuildItem beanArchiveIndexBuildItem, ExceptionMapperRecorder recorder) { IndexView index = beanArchiveIndexBuildItem.getIndex(); Collection<AnnotationInstance> restControllerAnnotations = index.getAnnotations(REST_CONTROLLER_ANNOTATION); if (restControllerAnnotations.isEmpty()) { return; } Map<String, NonJaxRsClassMappings> nonJaxRsPaths = new HashMap<>(); for (AnnotationInstance restControllerInstance : restControllerAnnotations) { String basePath = "/"; ClassInfo restControllerAnnotatedClass = restControllerInstance.target().asClass(); AnnotationInstance requestMappingInstance = restControllerAnnotatedClass.classAnnotation(REQUEST_MAPPING); if (requestMappingInstance != null) { String basePathFromAnnotation = getMappingValue(requestMappingInstance); if (basePathFromAnnotation != null) { basePath = basePathFromAnnotation; } } Map<String, String> methodNameToPath = new HashMap<>(); NonJaxRsClassMappings nonJaxRsClassMappings = new NonJaxRsClassMappings(); nonJaxRsClassMappings.setMethodNameToPath(methodNameToPath); nonJaxRsClassMappings.setBasePath(basePath); List<MethodInfo> methods = restControllerAnnotatedClass.methods(); // go through each of the methods and see if there are any mapping Spring annotation from which to get the path METHOD: for (MethodInfo method : methods) { String methodName = method.name(); String methodPath; // go through each of the annotations that can be used to make a method handle an http request for (DotName mappingClass : MAPPING_ANNOTATIONS) { AnnotationInstance mappingClassAnnotation = method.annotation(mappingClass); if (mappingClassAnnotation != null) { methodPath = getMappingValue(mappingClassAnnotation); if (methodPath == null) { methodPath = ""; // ensure that no nasty null values show up in the output } else if (!methodPath.startsWith("/")) { methodPath = "/" + methodPath; } // record the mapping of method to the http path methodNameToPath.put(methodName, methodPath); continue METHOD; } } } // if there was at least one controller method, add the controller since it contains methods that handle http requests if (!methodNameToPath.isEmpty()) { nonJaxRsPaths.put(restControllerAnnotatedClass.name().toString(), nonJaxRsClassMappings); } } if (!nonJaxRsPaths.isEmpty()) { recorder.nonJaxRsClassNameToMethodPaths(nonJaxRsPaths); } }
Example 16
Source File: AmazonLambdaProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@BuildStep List<AmazonLambdaBuildItem> discover(CombinedIndexBuildItem combinedIndexBuildItem, Optional<ProvidedAmazonLambdaHandlerBuildItem> providedLambda, BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer, BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer) throws BuildException { Collection<ClassInfo> allKnownImplementors = combinedIndexBuildItem.getIndex().getAllKnownImplementors(REQUEST_HANDLER); allKnownImplementors.addAll(combinedIndexBuildItem.getIndex() .getAllKnownImplementors(REQUEST_STREAM_HANDLER)); allKnownImplementors.addAll(combinedIndexBuildItem.getIndex() .getAllKnownSubclasses(SKILL_STREAM_HANDLER)); if (allKnownImplementors.size() > 0 && providedLambda.isPresent()) { throw new BuildException( "Multiple handler classes. You have a custom handler class and the " + providedLambda.get().getProvider() + " extension. Please remove one of them from your deployment.", Collections.emptyList()); } AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder().setUnremovable(); List<AmazonLambdaBuildItem> ret = new ArrayList<>(); for (ClassInfo info : allKnownImplementors) { if (Modifier.isAbstract(info.flags())) { continue; } final DotName name = info.name(); final String lambda = name.toString(); builder.addBeanClass(lambda); reflectiveClassBuildItemBuildProducer.produce(new ReflectiveClassBuildItem(true, false, lambda)); String cdiName = null; AnnotationInstance named = info.classAnnotation(NAMED); if (named != null) { cdiName = named.value().asString(); } ClassInfo current = info; boolean done = false; boolean streamHandler = info.superName().equals(SKILL_STREAM_HANDLER) ? true : false; while (current != null && !done) { for (MethodInfo method : current.methods()) { if (method.name().equals("handleRequest")) { if (method.parameters().size() == 3) { streamHandler = true; done = true; break; } else if (method.parameters().size() == 2 && !method.parameters().get(0).name().equals(DotName.createSimple(Object.class.getName()))) { reflectiveHierarchy.produce(new ReflectiveHierarchyBuildItem(method.parameters().get(0))); reflectiveHierarchy.produce(new ReflectiveHierarchyBuildItem(method.returnType())); done = true; break; } } } current = combinedIndexBuildItem.getIndex().getClassByName(current.superName()); } ret.add(new AmazonLambdaBuildItem(lambda, cdiName, streamHandler)); } additionalBeanBuildItemBuildProducer.produce(builder.build()); reflectiveClassBuildItemBuildProducer .produce(new ReflectiveClassBuildItem(true, true, true, FunctionError.class)); return ret; }
Example 17
Source File: ValueResolverGenerator.java From quarkus with Apache License 2.0 | 4 votes |
public void generate(ClassInfo clazz) { Objects.requireNonNull(clazz); String clazzName = clazz.name().toString(); if (analyzedTypes.contains(clazzName)) { return; } analyzedTypes.add(clazzName); boolean ignoreSuperclasses = false; // @TemplateData declared on class takes precedence AnnotationInstance templateData = clazz.classAnnotation(TEMPLATE_DATA); if (templateData == null) { // Try to find @TemplateData declared on other classes templateData = uncontrolled.get(clazz.name()); } else { AnnotationValue ignoreSuperclassesValue = templateData.value(IGNORE_SUPERCLASSES); if (ignoreSuperclassesValue != null) { ignoreSuperclasses = ignoreSuperclassesValue.asBoolean(); } } Predicate<AnnotationTarget> filters = initFilters(templateData); LOGGER.debugf("Analyzing %s", clazzName); String baseName; if (clazz.enclosingClass() != null) { baseName = simpleName(clazz.enclosingClass()) + NESTED_SEPARATOR + simpleName(clazz); } else { baseName = simpleName(clazz); } String targetPackage = packageName(clazz.name()); String generatedName = generatedNameFromTarget(targetPackage, baseName, SUFFIX); generatedTypes.add(generatedName.replace('/', '.')); ClassCreator valueResolver = ClassCreator.builder().classOutput(classOutput).className(generatedName) .interfaces(ValueResolver.class).build(); implementGetPriority(valueResolver); implementAppliesTo(valueResolver, clazz); implementResolve(valueResolver, clazzName, clazz, filters); valueResolver.close(); DotName superName = clazz.superName(); if (!ignoreSuperclasses && (superName != null && !superName.equals(OBJECT))) { ClassInfo superClass = index.getClassByName(clazz.superClassType().name()); if (superClass != null) { generate(superClass); } else { LOGGER.warnf("Skipping super class %s - not found in the index", clazz.superClassType()); } } }
Example 18
Source File: LiquibaseProcessor.java From keycloak with Apache License 2.0 | 4 votes |
@Record(ExecutionTime.STATIC_INIT) @BuildStep void configure(KeycloakRecorder recorder) { DotName liquibaseServiceName = DotName.createSimple(LiquibaseService.class.getName()); Map<String, List<String>> services = new HashMap<>(); try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/liquibase.idx")) { IndexReader reader = new IndexReader(in); Index index = reader.read(); for (Class<?> c : Arrays.asList(liquibase.diff.compare.DatabaseObjectComparator.class, liquibase.parser.NamespaceDetails.class, liquibase.precondition.Precondition.class, Database.class, ChangeLogParser.class, liquibase.change.Change.class, liquibase.snapshot.SnapshotGenerator.class, liquibase.changelog.ChangeLogHistoryService.class, liquibase.datatype.LiquibaseDataType.class, liquibase.executor.Executor.class, LockService.class, SqlGenerator.class)) { List<String> impls = new ArrayList<>(); services.put(c.getName(), impls); Set<ClassInfo> classes = new HashSet<>(); if (c.isInterface()) { classes.addAll(index.getAllKnownImplementors(DotName.createSimple(c.getName()))); } else { classes.addAll(index.getAllKnownSubclasses(DotName.createSimple(c.getName()))); } for (ClassInfo found : classes) { if (Modifier.isAbstract(found.flags()) || Modifier.isInterface(found.flags()) || !found.hasNoArgsConstructor() || !Modifier.isPublic(found.flags())) { continue; } AnnotationInstance annotationInstance = found.classAnnotation(liquibaseServiceName); if (annotationInstance == null || !annotationInstance.value("skip").asBoolean()) { impls.add(found.name().toString()); } } } } catch (IOException cause) { throw new RuntimeException("Failed to get liquibase jandex index", cause); } services.put(Logger.class.getName(), Arrays.asList(KeycloakLogger.class.getName())); services.put(LockService.class.getName(), Arrays.asList(DummyLockService.class.getName())); services.put(ChangeLogParser.class.getName(), Arrays.asList(XMLChangeLogSAXParser.class.getName())); services.get(SqlGenerator.class.getName()).add(CustomInsertLockRecordGenerator.class.getName()); services.get(SqlGenerator.class.getName()).add(CustomLockDatabaseChangeLogGenerator.class.getName()); recorder.configureLiquibase(services); }
Example 19
Source File: CustomScopeAnnotationsBuildItem.java From quarkus with Apache License 2.0 | 3 votes |
/** * Returns true if the given class has some of the custom scope annotations, false otherwise. * List of known custom scopes can be seen via {@link CustomScopeAnnotationsBuildItem#getCustomScopeNames()}. * In order to check for presence of any scope annotation (including built-in ones), * see {@link CustomScopeAnnotationsBuildItem#isScopeDeclaredOn(ClassInfo)}. * * @param clazz Class to check for annotations * @return true if the clazz contains some of the custom scope annotations, false otherwise */ public boolean isCustomScopeDeclaredOn(ClassInfo clazz) { for (DotName scope : customScopeNames) { if (clazz.classAnnotation(scope) != null) { return true; } } return false; }
Example 20
Source File: JandexProtoGenerator.java From kogito-runtimes with Apache License 2.0 | 3 votes |
protected String getReferenceOfModel(ClassInfo modelClazz, String name) { AnnotationInstance generatedData = modelClazz.classAnnotation(generatedAnnotation); if (generatedData != null) { return generatedData.value(name).asString(); } return null; }