/** Then one bean holding a reference to another (leaf-level) bean */
 public void testBeanHolder() throws Exception {
   ObjectMapper mapper = new ObjectMapper();
   mapper.registerModule(new MrBeanModule());
   BeanHolder holder = mapper.readValue("{\"bean\":{\"a\":\"b\",\"x\":-4 }}", BeanHolder.class);
   assertNotNull(holder);
   Bean bean = holder.getBean();
   assertNotNull(bean);
   assertEquals("b", bean.getA());
   assertEquals(-4, bean.getX());
 }
Exemplo n.º 2
0
 private <X> Bean<X> createGenericBean(
     BeanHolder<X> holder,
     GenericIdentifier identifier,
     BeanManager beanManager,
     Class<? extends Annotation> scopeOverride,
     boolean alternative,
     Class<?> beanClass) {
   Set<Annotation> qualifiers =
       getQualifiers(beanManager, identifier, Collections.<Annotation>emptySet());
   return new GenericManagedBean<X>(
       holder.getBean(),
       identifier,
       (InjectionTarget<X>) genericInjectionTargets.get(holder.getType()),
       holder.getType(),
       qualifiers,
       scopeOverride,
       annotatedMemberInjectionProvider,
       alternative,
       beanClass,
       beanManager);
 }