use of jodd.proxetta.AnnotationInfo in project jodd by oblac.
the class TargetClassInfoReader method visitEnd.
/**
* Stores signatures for all super public methods not already overridden by target class.
* All this methods will be accepted for proxyfication.
*/
@Override
public void visitEnd() {
// prepare class annotations
if (classAnnotations != null) {
annotations = classAnnotations.toArray(new AnnotationInfo[classAnnotations.size()]);
classAnnotations = null;
}
List<String> superList = new ArrayList<>();
Set<String> allInterfaces = new HashSet<>();
if (nextInterfaces != null) {
allInterfaces.addAll(nextInterfaces);
}
// check all public super methods that are not overridden in superclass
while (nextSupername != null) {
InputStream inputStream = null;
ClassReader cr = null;
try {
inputStream = ClassLoaderUtil.getClassAsStream(nextSupername, classLoader);
cr = new ClassReader(inputStream);
} catch (IOException ioex) {
throw new ProxettaException("Unable to inspect super class: " + nextSupername, ioex);
} finally {
StreamUtil.close(inputStream);
}
superList.add(nextSupername);
// remember the super class reader
superClassReaders.add(cr);
cr.accept(new SuperClassVisitor(), 0);
if (cr.getInterfaces() != null) {
Collections.addAll(allInterfaces, cr.getInterfaces());
}
}
superClasses = superList.toArray(new String[superList.size()]);
// check all interface methods that are not overridden in super-interface
for (String next : allInterfaces) {
InputStream inputStream = null;
ClassReader cr = null;
try {
inputStream = ClassLoaderUtil.getClassAsStream(next, classLoader);
cr = new ClassReader(inputStream);
} catch (IOException ioex) {
throw new ProxettaException("Unable to inspect super interface: " + next, ioex);
} finally {
StreamUtil.close(inputStream);
}
// remember the super class reader
superClassReaders.add(cr);
cr.accept(new SuperClassVisitor(), 0);
}
}
use of jodd.proxetta.AnnotationInfo in project jodd by oblac.
the class ProxyPointcutSupport method getAnnotation.
/**
* Returns <code>true</code> if method is annotated with provided annotation.
*/
public AnnotationInfo getAnnotation(MethodInfo methodInfo, Class<? extends Annotation> mi) {
AnnotationInfo[] anns = methodInfo.getAnnotations();
if (anns == null) {
return null;
}
String anName = mi.getName();
for (AnnotationInfo ann : anns) {
if (ann.getAnnotationClassname().equals(anName)) {
return ann;
}
}
return null;
}
use of jodd.proxetta.AnnotationInfo in project jodd by oblac.
the class ProxyPointcutSupport method getAnnotation.
/**
* Finds annotation in class info. Returns <code>null</code> if annotation doesn't exist.
*/
public AnnotationInfo getAnnotation(ClassInfo classInfo, Class<? extends Annotation> an) {
AnnotationInfo[] anns = classInfo.getAnnotations();
if (anns == null) {
return null;
}
String anName = an.getName();
for (AnnotationInfo ann : anns) {
if (ann.getAnnotationClassname().equals(anName)) {
return ann;
}
}
return null;
}
Aggregations