javax.interceptor.AroundConstruct Java Examples
The following examples show how to use
javax.interceptor.AroundConstruct.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GaugeRegistrationInterceptor.java From smallrye-metrics with Apache License 2.0 | 5 votes |
@AroundConstruct Object metrics(InvocationContext context) throws Exception { Class<?> type = context.getConstructor().getDeclaringClass(); Object target = context.proceed(); BeanInfoAdapter<Class<?>> beanInfoAdapter = new CDIBeanInfoAdapter(); MemberInfoAdapter<Member> memberInfoAdapter = new CDIMemberInfoAdapter(); // Registers the gauges over the bean type hierarchy after the target is constructed as it is required for the gauge invocations do { // TODO: discover annotations declared on implemented interfaces for (Method method : type.getDeclaredMethods()) { MetricResolver.Of<Gauge> gauge = resolver.gauge(beanInfoAdapter.convert(type), memberInfoAdapter.convert(method)); if (gauge.isPresent()) { AnnotationInfo g = gauge.metricAnnotation(); Metadata metadata = MetricsMetadata.getMetadata(g, gauge.metricName(), g.unit(), g.description(), g.displayName(), MetricType.GAUGE); registry.register(metadata, new ForwardingGauge(method, context.getTarget()), TagsUtils.parseTagsAsArray(g.tags())); } } type = type.getSuperclass(); } while (!Object.class.equals(type)); return target; }
Example #2
Source File: LifecycleInterceptor.java From quarkus with Apache License 2.0 | 5 votes |
@AroundConstruct void simpleAroundConstruct(InvocationContext ctx) throws Exception { Object bindings = ctx.getContextData().get(ArcInvocationContext.KEY_INTERCEPTOR_BINDINGS); if (bindings == null) { throw new IllegalArgumentException("No bindings found"); } try { AROUND_CONSTRUCTS.add(ctx.getConstructor()); ctx.proceed(); } catch (Exception e) { e.printStackTrace(); } }
Example #3
Source File: SimpleInterceptor.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct void aroundConstruct(InvocationContext ctx) throws Exception { aroundConstructResult = bean.getBeanClass().getName(); ctx.proceed(); }
Example #4
Source File: ExceptionMeteredInterceptor.java From metrics-cdi with Apache License 2.0 | 4 votes |
@AroundConstruct private Object meteredConstructor(InvocationContext context) throws Throwable { return meteredCallable(context, context.getConstructor()); }
Example #5
Source File: TimedInterceptor.java From metrics-cdi with Apache License 2.0 | 4 votes |
@AroundConstruct private Object timedConstructor(InvocationContext context) throws Exception { return timedCallable(context, context.getConstructor()); }
Example #6
Source File: CountedInterceptor.java From metrics-cdi with Apache License 2.0 | 4 votes |
@AroundConstruct private Object countedConstructor(InvocationContext context) throws Exception { return countedCallable(context, context.getConstructor()); }
Example #7
Source File: MeteredInterceptor.java From metrics-cdi with Apache License 2.0 | 4 votes |
@AroundConstruct private Object meteredConstructor(InvocationContext context) throws Exception { return meteredCallable(context, context.getConstructor()); }
Example #8
Source File: AroundConstructCdiTest.java From tomee with Apache License 2.0 | 4 votes |
@AroundConstruct public void ac(final InvocationContext ic) { constructured = true; }
Example #9
Source File: AroundConstructCdiTest.java From tomee with Apache License 2.0 | 4 votes |
@AroundConstruct public Object ac(InvocationContext ic) throws Exception { constructured = true; return ic.proceed(); }
Example #10
Source File: AroundConstructCdiTest.java From tomee with Apache License 2.0 | 4 votes |
@AroundConstruct public Object ac(InvocationContext ic) throws Exception { constructured = true; return ic.proceed(); }
Example #11
Source File: JAXRSFieldInjectionInterceptor.java From openwebbeans-meecrowave with Apache License 2.0 | 4 votes |
@AroundConstruct public Object injectContexts(final InvocationContext ic) throws Exception { doInject(ic); return ic.proceed(); }
Example #12
Source File: CountedInterceptor.java From ee8-sandbox with Apache License 2.0 | 4 votes |
@AroundConstruct public void aroundConstructed(InvocationContext ctx) throws Exception { LOG.log(Level.INFO, "invoke constructor:" + ctx.getConstructor() + ", arguments:" + ctx.getContextData()); Object o = ctx.proceed(); counter.increase(); }
Example #13
Source File: IgnoreNetAuthenticatorInterceptor.java From component-runtime with Apache License 2.0 | 4 votes |
@AroundConstruct public void onConstruct(final InvocationContext context) throws Exception { workaround.lazyInit(); context.proceed(); }
Example #14
Source File: JaxrsEndPointValidationInterceptor.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct @Override public void validateConstructorInvocation(InvocationContext ctx) throws Exception { super.validateConstructorInvocation(ctx); }
Example #15
Source File: MethodValidationInterceptor.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct @Override public void validateConstructorInvocation(InvocationContext ctx) throws Exception { super.validateConstructorInvocation(ctx); }
Example #16
Source File: MeteredInterceptor.java From smallrye-metrics with Apache License 2.0 | 4 votes |
@AroundConstruct Object meteredConstructor(InvocationContext context) throws Exception { return meteredCallable(context, context.getConstructor()); }
Example #17
Source File: AroundConstructReturningObjectTest.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct Object mySuperCoolAroundConstruct(InvocationContext ctx) throws Exception { INTERCEPTOR_CALLED.set(true); return ctx.proceed(); }
Example #18
Source File: AroundConstructAppliedViaConstructorTest.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct void mySuperCoolAroundConstruct(InvocationContext ctx) throws Exception { OTHER_INTERCEPTOR_CALLED.set(true); ctx.proceed(); }
Example #19
Source File: AroundConstructAppliedViaConstructorTest.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct void mySuperCoolAroundConstruct(InvocationContext ctx) throws Exception { INTERCEPTOR_CALLED.set(true); ctx.proceed(); }
Example #20
Source File: AroundConstructTest.java From quarkus with Apache License 2.0 | 4 votes |
@AroundConstruct void mySuperCoolAroundConstruct(InvocationContext ctx) throws Exception { INTERCEPTOR_CALLED.set(true); ctx.proceed(); }
Example #21
Source File: PaymentManipulationInterceptor.java From blog-tutorials with MIT License | 4 votes |
@AroundConstruct public void aroundConstructInterception(InvocationContext invocationContext) throws Exception { System.out.println(invocationContext.getConstructor().getDeclaringClass() + " will be manipulated"); invocationContext.proceed(); }
Example #22
Source File: TimedInterceptor.java From smallrye-metrics with Apache License 2.0 | 4 votes |
@AroundConstruct Object timedConstructor(InvocationContext context) throws Exception { return timedCallable(context, context.getConstructor()); }
Example #23
Source File: CountedInterceptor.java From smallrye-metrics with Apache License 2.0 | 4 votes |
@AroundConstruct Object countedConstructor(InvocationContext context) throws Exception { return countedCallable(context, context.getConstructor()); }
Example #24
Source File: SimplyTimedInterceptor.java From smallrye-metrics with Apache License 2.0 | 4 votes |
@AroundConstruct Object simplyTimedConstructor(InvocationContext context) throws Exception { return timedCallable(context, context.getConstructor()); }
Example #25
Source File: ConcurrentGaugeInterceptor.java From smallrye-metrics with Apache License 2.0 | 4 votes |
@AroundConstruct Object countedConstructor(InvocationContext context) throws Exception { return concurrentCallable(context, context.getConstructor()); }