Allow for reuse of key visitor classes in tooling
Based on https://github.com/SpringSource/spring-framework/pull/263
This commit is contained in:
parent
06fdfb0b0d
commit
0ea17c8382
|
|
@ -43,17 +43,17 @@ import org.springframework.util.MultiValueMap;
|
|||
* @author Costin Leau
|
||||
* @since 2.5
|
||||
*/
|
||||
final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor implements AnnotationMetadata {
|
||||
public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor implements AnnotationMetadata {
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
protected final ClassLoader classLoader;
|
||||
|
||||
private final Set<String> annotationSet = new LinkedHashSet<String>();
|
||||
protected final Set<String> annotationSet = new LinkedHashSet<String>();
|
||||
|
||||
private final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>(4);
|
||||
protected final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>(4);
|
||||
|
||||
private final Map<String, AnnotationAttributes> attributeMap = new LinkedHashMap<String, AnnotationAttributes>(4);
|
||||
protected final Map<String, AnnotationAttributes> attributeMap = new LinkedHashMap<String, AnnotationAttributes>(4);
|
||||
|
||||
private final MultiValueMap<String, MethodMetadata> methodMetadataMap = new LinkedMultiValueMap<String, MethodMetadata>();
|
||||
protected final MultiValueMap<String, MethodMetadata> methodMetadataMap = new LinkedMultiValueMap<String, MethodMetadata>();
|
||||
|
||||
|
||||
public AnnotationMetadataReadingVisitor(ClassLoader classLoader) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -39,22 +39,24 @@ import org.springframework.util.MultiValueMap;
|
|||
* @author Chris Beams
|
||||
* @since 3.0
|
||||
*/
|
||||
final class MethodMetadataReadingVisitor extends MethodVisitor implements MethodMetadata {
|
||||
public class MethodMetadataReadingVisitor extends MethodVisitor implements MethodMetadata {
|
||||
|
||||
private final String name;
|
||||
protected final String name;
|
||||
|
||||
private final int access;
|
||||
protected final int access;
|
||||
|
||||
private String declaringClassName;
|
||||
protected final String declaringClassName;
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
protected final ClassLoader classLoader;
|
||||
|
||||
private final MultiValueMap<String, MethodMetadata> methodMetadataMap;
|
||||
protected final MultiValueMap<String, MethodMetadata> methodMetadataMap;
|
||||
|
||||
protected final Map<String, AnnotationAttributes> attributeMap = new LinkedHashMap<String, AnnotationAttributes>(2);
|
||||
|
||||
private final Map<String, AnnotationAttributes> attributeMap = new LinkedHashMap<String, AnnotationAttributes>(2);
|
||||
|
||||
public MethodMetadataReadingVisitor(String name, int access, String declaringClassName, ClassLoader classLoader,
|
||||
MultiValueMap<String, MethodMetadata> methodMetadataMap) {
|
||||
|
||||
super(SpringAsmInfo.ASM_VERSION);
|
||||
this.name = name;
|
||||
this.access = access;
|
||||
|
|
@ -63,10 +65,11 @@ final class MethodMetadataReadingVisitor extends MethodVisitor implements Method
|
|||
this.methodMetadataMap = methodMetadataMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
|
||||
String className = Type.getType(desc).getClassName();
|
||||
methodMetadataMap.add(className, this);
|
||||
this.methodMetadataMap.add(className, this);
|
||||
return new AnnotationAttributesReadingVisitor(className, this.attributeMap, null, this.classLoader);
|
||||
}
|
||||
|
||||
|
|
@ -97,4 +100,5 @@ final class MethodMetadataReadingVisitor extends MethodVisitor implements Method
|
|||
public String getDeclaringClassName() {
|
||||
return this.declaringClassName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue