use of jodd.proxetta.data.HeroProxyAdvice2 in project jodd by oblac.
the class AnnTest method testClassAnnotationsProxy.
@Test
public void testClassAnnotationsProxy() {
ProxyProxetta proxetta = ProxyProxetta.withAspects(new ProxyAspect(HeroProxyAdvice2.class, new AllRealMethodsPointcut() {
@Override
public boolean apply(MethodInfo methodInfo) {
if (!methodInfo.isTopLevelMethod()) {
return false;
}
return super.apply(methodInfo);
}
}));
ProxettaBuilder proxettaBuilder = proxetta.builder();
proxettaBuilder.setTarget(Hero.class);
proxetta.setVariableClassName(true);
Hero hero = (Hero) proxettaBuilder.newInstance();
assertEquals("SilverHero89W99.222None1000speeeeedXRAYnull", hero.name());
}
use of jodd.proxetta.data.HeroProxyAdvice2 in project jodd by oblac.
the class AnnTest method testClassAnnotationsWrapper.
@Test
public void testClassAnnotationsWrapper() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
WrapperProxetta proxetta = WrapperProxetta.withAspects(new ProxyAspect(HeroProxyAdvice2.class, new AllRealMethodsPointcut() {
@Override
public boolean apply(MethodInfo methodInfo) {
if (!methodInfo.isTopLevelMethod()) {
return false;
}
return super.apply(methodInfo);
}
}));
WrapperProxettaBuilder proxettaBuilder = proxetta.builder();
proxettaBuilder.setTarget(Hero.class);
proxetta.setVariableClassName(true);
Object hero = proxettaBuilder.newInstance();
assertEquals("SilverHero89W99.222None1000speeeeedXRAYnull", ReflectUtil.invoke(hero, "name"));
}
Aggregations