javax.interceptor.Interceptor.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中javax.interceptor.Interceptor.<init>()方法的一些代码示例,展示了Interceptor.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interceptor.<init>()方法的具体详情如下:
包路径:javax.interceptor.Interceptor
类名称:Interceptor
方法名:<init>

Interceptor.<init>介绍

暂无

代码示例

代码示例来源:origin: javaee-samples/javaee7-samples

  1. /**
  2. * Class used to enable (activate) the dynamic interceptor and sets its priority
  3. *
  4. * @author Arjan Tijms
  5. *
  6. */
  7. @Interceptor
  8. @Priority(200)
  9. public class HelloInterceptorEnabler {
  10. }

代码示例来源:origin: javaee-samples/javaee7-samples

  1. /**
  2. * @author Arun Gupta
  3. */
  4. @Priority(Interceptor.Priority.APPLICATION + 10)
  5. @Interceptor
  6. @MyAroundConstructInterceptorBinding
  7. public class MyAroundConstructInterceptor {
  8. @AroundConstruct
  9. public void validateConstructor(InvocationContext context) {
  10. System.out.println("MyAroundConstructInterceptor.validateConstructor");
  11. }
  12. }

代码示例来源:origin: javaee-samples/javaee7-samples

  1. /**
  2. * Interceptors with smaller priority values are called first.
  3. *
  4. * @author Radim Hanus
  5. */
  6. @Interceptor
  7. @MyInterceptorBinding
  8. @Priority(Interceptor.Priority.APPLICATION + 200)
  9. public class LowPriorityInterceptor {
  10. @AroundInvoke
  11. public Object log(InvocationContext context) throws Exception {
  12. Object[] parameters = context.getParameters();
  13. if (parameters.length > 0 && parameters[0] instanceof String) {
  14. String param = (String) parameters[0];
  15. parameters[0] = param + " Nice to meet you.";
  16. context.setParameters(parameters);
  17. }
  18. return context.proceed();
  19. }
  20. }

代码示例来源:origin: javaee-samples/javaee7-samples

  1. /**
  2. * Interceptors with smaller priority values are called first.
  3. *
  4. * @author Radim Hanus
  5. */
  6. @Interceptor
  7. @MyInterceptorBinding
  8. @Priority(Interceptor.Priority.APPLICATION + 100)
  9. public class HighPriorityInterceptor {
  10. @AroundInvoke
  11. public Object log(InvocationContext context) throws Exception {
  12. Object[] parameters = context.getParameters();
  13. if (parameters.length > 0 && parameters[0] instanceof String) {
  14. String param = (String) parameters[0];
  15. parameters[0] = "Hi " + param + " !";
  16. context.setParameters(parameters);
  17. }
  18. return context.proceed();
  19. }
  20. }

代码示例来源:origin: jersey/jersey

  1. @Priority(value = Interceptor.Priority.PLATFORM_BEFORE + 199)
  2. @Interceptor
  3. @Transactional
  4. @JerseyVetoed

代码示例来源:origin: oracle/helidon

  1. /**
  2. * Interceptor for {@link Timed} annotation.
  3. */
  4. @Timed
  5. @Interceptor
  6. @Priority(Interceptor.Priority.PLATFORM_BEFORE + 10)
  7. final class InterceptorTimed extends InterceptorBase<Timer, Timed> {
  8. @Inject
  9. InterceptorTimed(MetricRegistry registry) {
  10. super(registry,
  11. Timed.class,
  12. Timed::name,
  13. Timed::absolute,
  14. MetricRegistry::getTimers,
  15. "timer");
  16. }
  17. @Override
  18. protected Object prepareAndInvoke(Timer timer, Timed annotation, InvocationContext context) throws Exception {
  19. return timer.time(context::proceed);
  20. }
  21. }

代码示例来源:origin: oracle/helidon

  1. /**
  2. * Interceptor for {@link Metered} annotation.
  3. */
  4. @Metered
  5. @Interceptor
  6. @Priority(Interceptor.Priority.PLATFORM_BEFORE + 9)
  7. final class InterceptorMetered extends InterceptorBase<Meter, Metered> {
  8. @Inject
  9. InterceptorMetered(MetricRegistry registry) {
  10. super(registry,
  11. Metered.class,
  12. Metered::name,
  13. Metered::absolute,
  14. MetricRegistry::getMeters,
  15. "meter");
  16. }
  17. @Override
  18. protected Object prepareAndInvoke(Meter meter, Metered annotation, InvocationContext context) throws Exception {
  19. meter.mark();
  20. return context.proceed();
  21. }
  22. }

代码示例来源:origin: jersey/jersey

  1. @Interceptor
  2. @Priority(Interceptor.Priority.PLATFORM_AFTER + 800)
  3. public class CdiInterceptorWrapper {

代码示例来源:origin: oracle/helidon

  1. @Interceptor
  2. @CommandBinding
  3. @Priority(Interceptor.Priority.LIBRARY_AFTER)
  4. public class CommandInterceptor {

代码示例来源:origin: oracle/helidon

  1. @Interceptor
  2. @Priority(Interceptor.Priority.PLATFORM_BEFORE + 8)
  3. final class InterceptorCounted extends InterceptorBase<Counter, Counted> {

代码示例来源:origin: hibernate/hibernate-validator

  1. @Interceptor
  2. @Priority(Interceptor.Priority.PLATFORM_AFTER + 800)
  3. public class ValidationInterceptor implements Serializable {

代码示例来源:origin: io.silverware/cdi-microservice-provider

  1. @Dependent
  2. @Interceptor()
  3. @Priority(Interceptor.Priority.APPLICATION)
  4. @SuppressWarnings("checkstyle:JavadocType")
  5. public static class LoggingInterceptor {
  6. @AroundInvoke
  7. public Object log(final InvocationContext ic) throws Exception {
  8. log.info("AroundInvoke " + ic.toString());
  9. return ic.proceed();
  10. }
  11. }

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

  1. @Interceptor
  2. @Priority(1002)
  3. @Binding
  4. public class Interceptor2 extends SuperInterceptor2 {
  5. @AroundInvoke
  6. public Object intercept1(InvocationContext ctx) throws Exception {
  7. ActionSequence.addAction(Interceptor2.class.getSimpleName());
  8. return ctx.proceed();
  9. }
  10. }

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

  1. @Interceptor
  2. @Priority(1001)
  3. @Binding
  4. public class Interceptor1 extends MiddleInterceptor1 {
  5. @AroundTimeout
  6. public Object interceptTimeout2(InvocationContext ctx) throws Exception {
  7. ActionSequence.addAction(Interceptor1.class.getSimpleName());
  8. return ctx.proceed();
  9. }
  10. }

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

  1. @Priority(995)
  2. @Transactional
  3. @Interceptor
  4. public class GloballyEnabledInterceptor1 extends AbstractInterceptor {
  5. }

代码示例来源:origin: com.github.endoscope/endoscope-cdi-plugin

  1. @Priority(Interceptor.Priority.APPLICATION)
  2. @Interceptor
  3. @WithEndoscope
  4. public class CdiInterceptor {
  5. @AroundInvoke
  6. public Object monitorOperation(InvocationContext ctx) throws Exception {
  7. return Endoscope.monitorEx(getCallNameFromContext(ctx), () -> ctx.proceed() );
  8. }
  9. protected String getCallNameFromContext(InvocationContext ctx) {
  10. return ctx.getMethod().getDeclaringClass().getSimpleName() + "." + ctx.getMethod().getName();
  11. }
  12. }

代码示例来源:origin: weld/core

  1. @Priority(TestInterceptor.PRIORITY)
  2. @Interceptor
  3. @TestInterceptorBinding
  4. public class TestInterceptor implements Serializable{
  5. public static final int PRIORITY = 10;
  6. @AroundInvoke
  7. public Object intercept(InvocationContext ctx) throws Exception {
  8. return ctx.proceed();
  9. }
  10. }

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

  1. @Priority(Interceptor.Priority.APPLICATION + 400)
  2. @ProductInterceptorBinding1
  3. @Interceptor
  4. public class ProductInterceptor1 {
  5. @AroundInvoke
  6. public Object aroundInvoke(InvocationContext invocationContext) throws Exception {
  7. ActionSequence.addAction(this.getClass().getSimpleName());
  8. return (1 + (Integer)invocationContext.proceed());
  9. }
  10. }

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

  1. @Priority(1015)
  2. @Transactional
  3. @Interceptor
  4. public class GloballyEnabledInterceptor3 extends AbstractInterceptor {
  5. }

代码示例来源:origin: org.talend.sdk.component/component-server-proxy

  1. @Interceptor
  2. @AutoErrorHandling(single = false)
  3. @Priority(Interceptor.Priority.LIBRARY_BEFORE - 1)
  4. public class MultipleErrorHandlerInterceptor implements Serializable {
  5. @Inject
  6. private ErrorProcessor errorProcessor;
  7. @AroundInvoke
  8. public Object handle(final InvocationContext context) throws Exception {
  9. return errorProcessor.handleResponses(CompletionStage.class.cast(context.proceed()));
  10. }
  11. }

相关文章

Interceptor类方法