tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hfe...@h41.de>
Subject Re: openejb.additionnal.callers in EmbeddedTomEEContainer ?
Date Tue, 25 Apr 2017 13:08:04 GMT
Ok, I found a solution to mange this problem. I have my own AnnotationFinder,
in this I override the Method findMetaAnnotatedClasses(...). 

There I have this code (all the code you can find
https://github.com/feidner/jsf-testing):

if(annotation == ManagedBean.class) {
    List<Annotated&lt;Class&lt;?>>> classes =
super.findMetaAnnotatedClasses(annotation);
    Set<Class&lt;?>> callers = getCallersFromSomewhere();       
    classes.add(new AnnotatedTestObject<>(caller)));
    return classes;
}

---------------------------

public class AnnotatedTestObject<T> implements Annotated<T> {
    private Annotation annotation = DefaultAnnotation.of(ManagedBean.class);
    private T obj;

    public AnnotatedTestObject(T obj) {
        this.obj = obj;
    }

    @Override
    public T get() {
        return obj;
    }

    @Override
    public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
        return (T)annotation;
    }

    @Override
    public Annotation[] getAnnotations() {
        return new Annotation[] { annotation };
    }

    @Override
    public Annotation[] getDeclaredAnnotations() {
        return new Annotation[] { annotation };
    }
    
}





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/openejb-additionnal-callers-in-EmbeddedTomEEContainer-tp4681588p4681593.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Mime
View raw message