Java Code Examples for org.springframework.core.annotation.AnnotationAttributes#forEach()

The following examples show how to use org.springframework.core.annotation.AnnotationAttributes#forEach() . 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: MethodMetadataReadingVisitor.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
@Nullable
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString) {
	if (!this.attributesMap.containsKey(annotationName)) {
		return null;
	}
	MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
	List<AnnotationAttributes> attributesList = this.attributesMap.get(annotationName);
	if (attributesList != null) {
		for (AnnotationAttributes annotationAttributes : attributesList) {
			AnnotationAttributes convertedAttributes = AnnotationReadingVisitorUtils.convertClassValues(
					"method '" + getMethodName() + "'", this.classLoader, annotationAttributes, classValuesAsString);
			convertedAttributes.forEach(allAttributes::add);
		}
	}
	return allAttributes;
}
 
Example 2
Source File: MethodMetadataReadingVisitor.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
@Nullable
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString) {
	if (!this.attributesMap.containsKey(annotationName)) {
		return null;
	}
	MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
	List<AnnotationAttributes> attributesList = this.attributesMap.get(annotationName);
	if (attributesList != null) {
		for (AnnotationAttributes annotationAttributes : attributesList) {
			AnnotationAttributes convertedAttributes = AnnotationReadingVisitorUtils.convertClassValues(
					"method '" + getMethodName() + "'", this.classLoader, annotationAttributes, classValuesAsString);
			convertedAttributes.forEach(allAttributes::add);
		}
	}
	return allAttributes;
}
 
Example 3
Source File: AnnotationAttributesBootstrap.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
private static void print(AnnotationAttributes annotationAttributes) {

        System.out.printf("注解 @%s 属性集合 : \n", annotationAttributes.annotationType().getName());

        annotationAttributes.forEach((name, value) ->
                System.out.printf("\t属性 %s : %s \n", name, value)
        );
    }