org.springframework.stereotype.Indexed Java Examples

The following examples show how to use org.springframework.stereotype.Indexed. 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: ClassPathScanningCandidateComponentProvider.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine if the specified include {@link TypeFilter} is supported by the index.
 * @param filter the filter to check
 * @return whether the index supports this include filter
 * @since 5.0
 * @see #extractStereotype(TypeFilter)
 */
private boolean indexSupportsIncludeFilter(TypeFilter filter) {
	if (filter instanceof AnnotationTypeFilter) {
		Class<? extends Annotation> annotation = ((AnnotationTypeFilter) filter).getAnnotationType();
		return (AnnotationUtils.isAnnotationDeclaredLocally(Indexed.class, annotation) ||
				annotation.getName().startsWith("javax."));
	}
	if (filter instanceof AssignableTypeFilter) {
		Class<?> target = ((AssignableTypeFilter) filter).getTargetType();
		return AnnotationUtils.isAnnotationDeclaredLocally(Indexed.class, target);
	}
	return false;
}
 
Example #2
Source File: AnnotatedElementUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void getMetaAnnotationTypesOnClassWithMetaDepth1() {
	Set<String> names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class);
	assertEquals(names(Transactional.class, Component.class, Indexed.class), names);

	names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class.getName());
	assertEquals(names(Transactional.class, Component.class, Indexed.class), names);
}
 
Example #3
Source File: AnnotatedElementUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void getMetaAnnotationTypesOnClassWithMetaDepth2() {
	Set<String> names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class);
	assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names);

	names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class.getName());
	assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names);
}
 
Example #4
Source File: MergedAnnotationsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void streamWhenFromClassWithMetaDepth2() {
	Stream<Class<?>> classes = MergedAnnotations.from(ComposedTransactionalComponent.class)
			.stream().map(MergedAnnotation::getType);
	assertThat(classes).containsExactly(TransactionalComponent.class,
			Transactional.class, Component.class, Indexed.class);
}
 
Example #5
Source File: ClassPathScanningCandidateComponentProvider.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine if the specified include {@link TypeFilter} is supported by the index.
 * @param filter the filter to check
 * @return whether the index supports this include filter
 * @since 5.0
 * @see #extractStereotype(TypeFilter)
 */
private boolean indexSupportsIncludeFilter(TypeFilter filter) {
	if (filter instanceof AnnotationTypeFilter) {
		Class<? extends Annotation> annotation = ((AnnotationTypeFilter) filter).getAnnotationType();
		return (AnnotationUtils.isAnnotationDeclaredLocally(Indexed.class, annotation) ||
				annotation.getName().startsWith("javax."));
	}
	if (filter instanceof AssignableTypeFilter) {
		Class<?> target = ((AssignableTypeFilter) filter).getTargetType();
		return AnnotationUtils.isAnnotationDeclaredLocally(Indexed.class, target);
	}
	return false;
}
 
Example #6
Source File: AnnotatedElementUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void getMetaAnnotationTypesOnClassWithMetaDepth1() {
	Set<String> names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class);
	assertEquals(names(Transactional.class, Component.class, Indexed.class), names);

	names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class.getName());
	assertEquals(names(Transactional.class, Component.class, Indexed.class), names);
}
 
Example #7
Source File: AnnotatedElementUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void getMetaAnnotationTypesOnClassWithMetaDepth2() {
	Set<String> names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class);
	assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names);

	names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class.getName());
	assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names);
}
 
Example #8
Source File: MergedAnnotationsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void streamWhenFromClassWithMetaDepth1() {
	Stream<Class<?>> classes = MergedAnnotations.from(TransactionalComponent.class)
			.stream().map(MergedAnnotation::getType);
	assertThat(classes).containsExactly(Transactional.class, Component.class, Indexed.class);
}