Package org.jboss.beans.metadata.plugins

Examples of org.jboss.beans.metadata.plugins.AbstractConstructorMetaData


   }
  
   public void testWeldMcBeanConstructorMetaDataAnnotation()
   {
      AbstractBeanMetaData bmd = new AbstractBeanMetaData("Test", McBeanWithNoWeldAnnotations.class.getName());
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      AbstractParameterMetaData pmd = new AbstractParameterMetaData(Object.class.getName(), "Test");
      cmd.setParameters(Collections.singletonList((ParameterMetaData)pmd));
      cmd.setAnnotations(createWeldAnnotationMetaData());
      bmd.setConstructor(cmd);
     
      checkMcBean(bmd, true);
   }
View Full Code Here


      beanType.pushInterceptor(constructorQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractBeanMetaData bean = (AbstractBeanMetaData) parent;
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child;
            bean.setConstructor(constructor);
         }
      });

      // beanfactory has a constructor
      beanFactoryType.pushInterceptor(constructorQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            GenericBeanFactoryMetaData bean = (GenericBeanFactoryMetaData) parent;
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child;
            bean.setBeanConstructor(constructor);
         }
      });

      // classloader binding
      TypeBinding classloaderType = schemaBinding.getType(classloaderTypeQName);
      configureValueBindings(classloaderType);
      classloaderType.setHandler(new DefaultElementHandler()
      {
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new AbstractClassLoaderMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
         }
      });

      // constructor binding
      TypeBinding constructorType = schemaBinding.getType(constructorTypeQName);
      constructorType.setHandler(new DefaultElementHandler()
      {
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new AbstractConstructorMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) o;
            for (int i = 0; i < attrs.getLength(); ++i)
            {
               String localName = attrs.getLocalName(i);
               if ("factoryClass".equals(localName))
                  constructor.setFactoryClass(attrs.getValue(i));
               else if ("factoryMethod".equals(localName))
                  constructor.setFactoryMethod(attrs.getValue(i));
            }
         }
      });

      // constructor has a factory
      constructorType.pushInterceptor(factoryQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) parent;
            AbstractDependencyValueMetaData factory = (AbstractDependencyValueMetaData) child;
            constructor.setFactory(factory);
         }
      });

      // constructor has a list parameters
      constructorType.pushInterceptor(parameterQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) parent;
            AbstractParameterMetaData parameter = (AbstractParameterMetaData) child;
            List parameters = constructor.getParameters();
            if (parameters == null)
            {
               parameters = new ArrayList();
               constructor.setParameters(parameters);
            }
            parameters.add(parameter);
         }
      });
View Full Code Here

      GenericBeanFactoryMetaData metaData1 = new GenericBeanFactoryMetaData("Name1", SimpleBeanImpl.class.getName());
      metaData1.addBeanProperty(new AbstractPropertyMetaData("string", "String1"));
     
      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanWithConstructorDependencyImpl.class.getName());
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", "String2"));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      ArrayList constructor2 = new ArrayList();
      constructor2.add(new AbstractParameterMetaData(GenericBeanFactory.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      cmd.setParameters(constructor2);
      metaData2.setBeanConstructor(cmd);
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      GenericBeanFactoryMetaData metaData1 = new GenericBeanFactoryMetaData("Name1", SimpleBeanImpl.class.getName());
      metaData1.addBeanProperty(new AbstractPropertyMetaData("string", "String1"));
     
      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanWithConstructorDependencyImpl.class.getName());
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", "String2"));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      ArrayList constructor2 = new ArrayList();
      constructor2.add(new AbstractParameterMetaData(GenericBeanFactory.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      cmd.setParameters(constructor2);
      metaData2.setBeanConstructor(cmd);
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      GenericBeanFactoryMetaData metaData1 = new GenericBeanFactoryMetaData("Name1", SimpleBeanImpl.class.getName());
      metaData1.addBeanProperty(new AbstractPropertyMetaData("string", "String1"));
     
      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanWithConstructorDependencyImpl.class.getName());
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", "String2"));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      ArrayList constructor2 = new ArrayList();
      constructor2.add(new AbstractParameterMetaData(GenericBeanFactory.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      cmd.setParameters(constructor2);
      metaData2.setBeanConstructor(cmd);
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      attributes1.add(new AbstractPropertyMetaData("string", "String1"));
      metaData1.setProperties(attributes1);

      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("aspect");
      metaData2.addProperty(new AbstractPropertyMetaData("bean", SimpleBeanWithDependencyImpl.class.getName()));
      metaData2.addProperty(new AbstractPropertyMetaData("constructor", new AbstractConstructorMetaData()));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("simpleBean", new AbstractDependencyValueMetaData("simple")));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", new AbstractValueMetaData("factory")));
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      attributes1.add(new AbstractPropertyMetaData("string", "String1"));
      metaData1.setProperties(attributes1);

      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("aspect");
      metaData2.addProperty(new AbstractPropertyMetaData("bean", SimpleBeanWithDependencyImpl.class.getName()));
      metaData2.addProperty(new AbstractPropertyMetaData("constructor", new AbstractConstructorMetaData()));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("simpleBean", new AbstractDependencyValueMetaData("simple")));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", new AbstractValueMetaData("factory")));
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      attributes1.add(new AbstractPropertyMetaData("string", "String1"));
      metaData1.setProperties(attributes1);

      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("aspect");
      metaData2.addProperty(new AbstractPropertyMetaData("bean", SimpleBeanWithDependencyImpl.class.getName()));
      metaData2.addProperty(new AbstractPropertyMetaData("constructor", new AbstractConstructorMetaData()));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("simpleBean", new AbstractDependencyValueMetaData("simple")));
      metaData2.addBeanProperty(new AbstractPropertyMetaData("string", new AbstractValueMetaData("factory")));
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      HashSet attributes2 = new HashSet();
      attributes2.add(new AbstractPropertyMetaData("string", "String2"));
      metaData2.setProperties(attributes2);
      ArrayList constructor2 = new ArrayList();
      constructor2.add(new AbstractParameterMetaData(SimpleBean.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      metaData2.setConstructor(cmd);
      cmd.setParameters(constructor2);
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

      HashSet attributes2 = new HashSet();
      attributes2.add(new AbstractPropertyMetaData("string", "String2"));
      metaData2.setProperties(attributes2);
      ArrayList constructor2 = new ArrayList();
      constructor2.add(new AbstractParameterMetaData(SimpleBean.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      metaData2.setConstructor(cmd);
      cmd.setParameters(constructor2);
     
      setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
   }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.plugins.AbstractConstructorMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.