本文整理汇总了Java中javax.interceptor.AroundConstruct类的典型用法代码示例。如果您正苦于以下问题:Java AroundConstruct类的具体用法?Java AroundConstruct怎么用?Java AroundConstruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AroundConstruct类属于javax.interceptor包,在下文中一共展示了AroundConstruct类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: aroundConstruct
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public Object aroundConstruct(InvocationContext ic) throws Exception {
logger.info("Executing " + ic.getConstructor());
Map<String, Object> data = ic.getContextData();
data.forEach((k, v) -> logger.info("data key: " + k + " - value: " + v));
return ic.proceed();
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:8,代码来源:LoggingInterceptor.java
示例2: aroundConstruct
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
Object aroundConstruct(InvocationContext ctx) throws Exception {
try {
return ctx.proceed();
} finally {
if (log.isTraceEnabled()) {
log.trace("[Lifecycle][@AroundConstruct] {}", ctx.getTarget().toString());
}
}
}
开发者ID:namioka,项目名称:eclipselink-example,代码行数:11,代码来源:TraceBeanLifecycleInterceptor.java
示例3: onConstruct
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public Object onConstruct(InvocationContext context) throws Exception {
// null before the InvocationContext.proceed() returns
Object target = context.getTarget();
isNull(target);
// null in case of AroundConstruct
Method method = context.getMethod();
isNull(method);
// NOT null in case of AroundConstruct
Constructor ctor = context.getConstructor();
isNotNull(ctor);
// perform the constructor injection
Object result = context.proceed();
isNull(result);
// NOT null after the InvocationContext.proceed() completes
target = context.getTarget();
isNotNull(target);
// a constructor should have been called
GreetingBean bean = (GreetingBean) target;
isBoolean(bean.isConstructed(), true);
isBoolean(bean.isInitialized(), false);
// constructor injection should have been done
isNotNull(bean.getParam());
return null;
}
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:29,代码来源:MyInterceptor.java
示例4: constructorLogger
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public void constructorLogger(InvocationContext ctx) throws Exception {
System.out.println("Logging constructor: about to call the constructor at " + System.currentTimeMillis());
// we must proceed to constructor before call getTarget(), otherwise we'll get a NullPointerException
ctx.proceed();
// now we can get the created object
System.out.println("Logging constructor: " + ctx.getTarget() + " at " + System.currentTimeMillis());
}
开发者ID:wesleyegberto,项目名称:javaee_projects,代码行数:10,代码来源:LoggerInterceptor.java
示例5: aroundConstructed
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@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();
}
开发者ID:hantsy,项目名称:ee8-sandbox,代码行数:7,代码来源:CountedInterceptor.java
示例6: meteredConstructor
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
private Object meteredConstructor(InvocationContext context) throws Exception {
return meteredCallable(context, context.getConstructor());
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:MeteredInterceptor.java
示例7: countedConstructor
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
private Object countedConstructor(InvocationContext context) throws Exception {
return countedCallable(context, context.getConstructor());
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:CountedInterceptor.java
示例8: timedConstructor
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
private Object timedConstructor(InvocationContext context) throws Exception {
return timedCallable(context, context.getConstructor());
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:5,代码来源:TimedInterceptor.java
示例9: validateConstructor
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public void validateConstructor(InvocationContext context) {
System.out.println("MyAroundConstructInterceptor.validateConstructor");
}
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:5,代码来源:MyAroundConstructInterceptor.java
示例10: ac
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public Object ac(InvocationContext ic) throws Exception {
constructured = true;
return ic.proceed();
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:AroundConstructCdiTest.java
示例11: meteredConstructor
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
private Object meteredConstructor(InvocationContext context) throws Throwable {
return meteredCallable(context, context.getConstructor());
}
开发者ID:astefanutti,项目名称:metrics-cdi,代码行数:5,代码来源:ExceptionMeteredInterceptor.java
示例12: createCdiFXMLComponent
import javax.interceptor.AroundConstruct; //导入依赖的package包/类
@AroundConstruct
public void createCdiFXMLComponent(final InvocationContext invocationContext) throws Exception {
// Performs c-tor invocation. Afterwards "invocationContext.getTarget()" will no longer return "null".
invocationContext.proceed();
// Fetches the newly created annotated object and it's class.
final Object target = invocationContext.getTarget();
final Class<?> targetClass = target.getClass();
final FXMLComponent annotation = targetClass.getAnnotation(FXMLComponent.class);
if (annotation == null) {
throw new IllegalStateException(String.format("No @FXMLComponent annotation could be retrieved from class %s.", targetClass.getName()));
}
final FXMLLoader fxmlLoader = new CdiFXMLLoader();
CdiFXMLLoaderFactory.initializeFXMLLoader(
fxmlLoader,
targetClass,
annotation.location(),
annotation.resources(),
annotation.charset());
fxmlLoader.setRoot(target);
fxmlLoader.setController(target);
// We now have to perform the actual loading of the FXML document.
// ... we have to make sure that this happens on the right (thus: FX application) thread, though!
if (Platform.isFxApplicationThread()) {
fxmlLoader.load();
} else {
final CountDownLatch latch = new CountDownLatch(1);
Platform.runLater(() -> {
try {
final Object loaded = fxmlLoader.load();
latch.countDown();
} catch (final IOException e) {
throw new IllegalStateException("Loading of FXML file failed.", e);
}
});
latch.await();
}
}
开发者ID:cathive,项目名称:fx-inject,代码行数:43,代码来源:FXMLComponentInterceptor.java
注:本文中的javax.interceptor.AroundConstruct类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论