5 Replies Latest reply on Aug 19, 2009 7:40 AM by Kabir Khan

    Adding annotations to MDR via bean metadata

    Kabir Khan Master

      I am creating a bean metadata with some annotations added

       AbstractBeanMetaData metaData = new AbstractBeanMetaData("McBean", McBeanAnnotationsFromMetaData.class.getName());
       metaData.setAccessMode(BeanAccessMode.ALL);
      
       AbstractConstructorMetaData ctor = new AbstractConstructorMetaData();
       AnnotationMetaData initializer = new AbstractAnnotationMetaData("@" + Initializer.class.getName());
       ctor.setAnnotations(Collections.singleton(initializer));
       metaData.setConstructor(ctor);
      


      I create a KCC from that and deploy it. When I read the metadata from my describe action there are no annotations in the metadata:

       private AnnotatedType<T> createMdrDecoratedAnnotatedType(Class<T> clazz)
       {
       AnnotatedType<T> type = context.getManager().createAnnotatedType(clazz);
      
       KernelController controller = (KernelController)context.getController();
       Kernel kernel = controller.getKernel();
       KernelMetaDataRepository repository = kernel.getMetaDataRepository();
       MetaData metaData = repository.getMetaData(context);
      
       return MDRAnnotatedTypeFactory.getInstance().getAnnotatedType(type, metaData);
       }
      
      

      Am I adding them wrong?