Search in sources :

Example 1 with ProxyAspect

use of jodd.proxetta.ProxyAspect in project jodd by oblac.

the class GenericsInDefaultTest method testClassesWithGenericsAsReturnValueProxyDefault.

@Test
public void testClassesWithGenericsAsReturnValueProxyDefault() {
    try {
        ProxyAspect aspect = new ProxyAspect(DelegateAdvice.class);
        ProxyProxetta proxetta = ProxyProxetta.withAspects(aspect);
        ProxyProxettaBuilder builder = proxetta.builder(Foo.class);
        builder.newInstance();
    } catch (Exception ex) {
        ex.printStackTrace();
        fail(ex.toString());
    }
}
Also used : ProxyProxetta(jodd.proxetta.impl.ProxyProxetta) ProxyProxettaBuilder(jodd.proxetta.impl.ProxyProxettaBuilder) ProxyAspect(jodd.proxetta.ProxyAspect) Test(org.junit.Test)

Example 2 with ProxyAspect

use of jodd.proxetta.ProxyAspect in project jodd by oblac.

the class PetiteHelper method createProxyProxetta.

public static ProxyProxetta createProxyProxetta() {
    ProxyPointcut pointcut_logged = new MethodAnnotationPointcut(Logged.class);
    ProxyAspect aspect_logged = new ProxyAspect(LogProxyAdvice.class, pointcut_logged);
    return ProxyProxetta.withAspects(aspect_logged);
}
Also used : MethodAnnotationPointcut(jodd.proxetta.pointcuts.MethodAnnotationPointcut) ProxyAspect(jodd.proxetta.ProxyAspect) ProxyPointcut(jodd.proxetta.ProxyPointcut)

Example 3 with ProxyAspect

use of jodd.proxetta.ProxyAspect in project jodd by oblac.

the class PetiteHelper method createProxyProxetta.

public static ProxyProxetta createProxyProxetta() {
    ProxyPointcut pointcut_logged = new MethodAnnotationPointcut(Logged.class);
    ProxyAspect aspect_logged = new ProxyAspect(LogProxyAdvice.class, pointcut_logged);
    ProxyProxetta proxetta = ProxyProxetta.withAspects(aspect_logged);
    return proxetta;
}
Also used : ProxyProxetta(jodd.proxetta.impl.ProxyProxetta) MethodAnnotationPointcut(jodd.proxetta.pointcuts.MethodAnnotationPointcut) ProxyAspect(jodd.proxetta.ProxyAspect) ProxyPointcut(jodd.proxetta.ProxyPointcut)

Example 4 with ProxyAspect

use of jodd.proxetta.ProxyAspect in project jodd by oblac.

the class GenericsInDefaultTest method testClassesWithGenericsAsReturnValueWrapperDefault.

@Test
public void testClassesWithGenericsAsReturnValueWrapperDefault() {
    try {
        ProxyAspect aspect = new ProxyAspect(DelegateAdvice.class);
        WrapperProxetta proxetta = WrapperProxetta.withAspects(aspect);
        WrapperProxettaBuilder builder = proxetta.builder(Foo.class, IFoo.class);
        builder.newInstance();
    } catch (Exception ex) {
        ex.printStackTrace();
        fail(ex.toString());
    }
}
Also used : WrapperProxettaBuilder(jodd.proxetta.impl.WrapperProxettaBuilder) WrapperProxetta(jodd.proxetta.impl.WrapperProxetta) ProxyAspect(jodd.proxetta.ProxyAspect) Test(org.junit.Test)

Example 5 with ProxyAspect

use of jodd.proxetta.ProxyAspect in project jodd by oblac.

the class MethrefTest method testMethRefOnProxifiedClass.

@Test
public void testMethRefOnProxifiedClass() {
    Methref<? extends Oink> m = Methref.on(Oink.class);
    m.to().woink();
    assertEquals("woink", m.ref());
    ProxyAspect a1 = new ProxyAspect(DummyAdvice.class, new AllTopMethodsPointcut());
    ProxyProxetta pp = ProxyProxetta.withAspects(a1);
    Oink oink = (Oink) pp.builder(Oink.class).newInstance();
    assertFalse(oink.getClass().equals(Oink.class));
    m = Methref.on(oink.getClass());
    m.to().woink();
    assertEquals("woink", m.ref());
}
Also used : ProxyProxetta(jodd.proxetta.impl.ProxyProxetta) AllTopMethodsPointcut(jodd.proxetta.pointcuts.AllTopMethodsPointcut) ProxyAspect(jodd.proxetta.ProxyAspect) Test(org.junit.Test)

Aggregations

ProxyAspect (jodd.proxetta.ProxyAspect)6 ProxyProxetta (jodd.proxetta.impl.ProxyProxetta)4 Test (org.junit.Test)4 ProxyPointcut (jodd.proxetta.ProxyPointcut)2 MethodAnnotationPointcut (jodd.proxetta.pointcuts.MethodAnnotationPointcut)2 ProxettaAwarePetiteContainer (jodd.petite.proxetta.ProxettaAwarePetiteContainer)1 ProxyProxettaBuilder (jodd.proxetta.impl.ProxyProxettaBuilder)1 WrapperProxetta (jodd.proxetta.impl.WrapperProxetta)1 WrapperProxettaBuilder (jodd.proxetta.impl.WrapperProxettaBuilder)1 AllRealMethodsPointcut (jodd.proxetta.pointcuts.AllRealMethodsPointcut)1 AllTopMethodsPointcut (jodd.proxetta.pointcuts.AllTopMethodsPointcut)1