/** * Construct a casting injector. * * @param injector an injector of any type * @param type a class of the injected type * @param <T> the type of the injected value * @return an Injector which implements {@code Injector<Object>} */ public static <T> Injector<Object> cast(Injector<T> injector, Class<T> type) { return new CastingInjector<T>(injector, type); } }
/** * Construct a casting injector. * * @param injector an injector of any type * @param type a class of the injected type * @param <T> the type of the injected value * @return an Injector which implements {@code Injector<Object>} */ public static <T> Injector<Object> cast(Injector<T> injector, Class<T> type) { return new CastingInjector<T>(injector, type); } }
public static void addService(ServiceTarget target) { JPAUserTransactionListenerService jpaUserTransactionListenerService = new JPAUserTransactionListenerService(); target.addService(SERVICE_NAME, jpaUserTransactionListenerService) .addDependency(UserTransactionRegistryService.SERVICE_NAME, Object.class, new CastingInjector<UserTransactionRegistry>(jpaUserTransactionListenerService.getUserTransactionRegistryInjectedValue(), UserTransactionRegistry.class)) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); } }
public static void addService(ServiceTarget target) { JPAUserTransactionListenerService jpaUserTransactionListenerService = new JPAUserTransactionListenerService(); target.addService(SERVICE_NAME, jpaUserTransactionListenerService) .addDependency(UserTransactionRegistryService.SERVICE_NAME, new CastingInjector<UserTransactionRegistry>(jpaUserTransactionListenerService.getUserTransactionRegistryInjectedValue(), UserTransactionRegistry.class)) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); } }
builder.addDependency(puServiceName.append(FIRST_PHASE), Object.class, new CastingInjector<>(service.getPhaseOnePersistenceUnitServiceImplInjector(), PhaseOnePersistenceUnitServiceImpl.class)); builder.addDependency(beanManagerServiceName(deploymentUnit), Object.class, new CastingInjector<BeanManager>(service.getBeanManagerInjector(), BeanManager.class));
builder.addDependency(puServiceName.append(FIRST_PHASE), new CastingInjector<>(service.getPhaseOnePersistenceUnitServiceImplInjector(), PhaseOnePersistenceUnitServiceImpl.class)); builder.addDependency(beanManagerServiceName(deploymentUnit), new CastingInjector<BeanManager>(service.getBeanManagerInjector(), BeanManager.class));
builder.addDependency(beanManagerServiceName(deploymentUnit), Object.class, new CastingInjector<BeanManager>(service.getBeanManagerInjector(), BeanManager.class));
builder.addDependency(beanManagerServiceName(deploymentUnit), new CastingInjector<BeanManager>(service.getBeanManagerInjector(), BeanManager.class));