Examples of Ctor


Examples of org.jboss.javabean.plugins.xml.Common.Ctor

      if (className == null)
         throw new IllegalArgumentException("No class attribute for " + elementName);
     
      try
      {
         Ctor ctor = new Ctor(className);
         holder.setValue(ctor);
      }
      catch (RuntimeException e)
      {
         throw e;
View Full Code Here

Examples of org.jboss.javabean.plugins.xml.Common.Ctor

      Object result = holder.getValue();
     
      // We still have a constructor because there was no constructor element
      if (result != null && result instanceof Ctor)
      {
         Ctor ctor = (Ctor) result;
         result = ctor.getValue();

         // The constructor was never run
         if (result == null)
         {
            try
            {
               return ctor.newInstance();
            }
            catch (Throwable t)
            {
               new RuntimeException("Unable to construct object javabean", t);
            }
View Full Code Here

Examples of org.jboss.javabean.plugins.xml.Common.Ctor

      try
      {
         if( parentValue instanceof Ctor )
         {
            Ctor ctor = (Ctor) parentValue;
            if( ctor.isCtorWasDeclared() )
            {
               BeanInfo beanInfo = ConfigurationUtil.getBeanInfo(ctor.getClassName());
               PropertyInfo propertyInfo = beanInfo.getProperty(property);
               value = ConfigurationUtil.convertValue(propertyInfo, prop.getType(), value);
               ctor.addParam(propertyInfo.getType().getName(), value);
            }
            else
            {
               // There was no explicit ctor to create the bean and reset the parent value
               parentValue = ctor.newInstance();
               holder.setValue(parentValue);
               add(parent, child, name);
            }
         }
         else
View Full Code Here

Examples of org.jboss.javabean.plugins.xml.Common.Ctor

   public static final ConstructorHandler HANDLER = new ConstructorHandler();

   public Object startElement(Object parent, QName name, ElementBinding element)
   {
      Holder holder = (Holder) parent;
      Ctor ctor = (Ctor) holder.getValue();
      ctor.setCtorWasDeclared(true);
      return holder;
   }
View Full Code Here

Examples of org.jboss.javabean.plugins.xml.Common.Ctor

   }

   public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
   {
      Holder holder = (Holder) o;
      Ctor ctor = (Ctor) holder.getValue();
      Common.Constructor constructor = ctor.getConstructor();
      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));
      }
      if( constructor.getFactoryMethod() != null && constructor.getFactoryClass() == null )
         constructor.setFactoryClass(ctor.getClassName());
   }
View Full Code Here

Examples of org.jboss.javabean.plugins.xml.Common.Ctor

   }

   public Object endElement(Object o, QName qName, ElementBinding element)
   {
      Holder holder = (Holder) o;
      Ctor ctor = (Ctor) holder.getValue();
      try
      {
         return ctor.newInstance();
      }
      catch (RuntimeException e)
      {
         throw e;
      }
      catch (Error e)
      {
         throw e;
      }
      catch (Throwable t)
      {
         throw new RuntimeException("Error instantiating class " + ctor.getClassName(), t);
      }

   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.