Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.component.creation » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with this
    4    * work for additional information regarding copyright ownership. The ASF
    5    * licenses this file to You under the Apache License, Version 2.0 (the
    6    * "License"); you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
    9    * or agreed to in writing, software distributed under the License is
   10    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   11    * KIND, either express or implied. See the License for the specific language
   12    * governing permissions and limitations under the License.
   13    */
   14   package org.apache.webbeans.component.creation;
   15   
   16   import java.lang.reflect.Constructor;
   17   
   18   import org.apache.webbeans.component.ManagedBean;
   19   import org.apache.webbeans.config.DefinitionUtil;
   20   import org.apache.webbeans.config.ManagedBeanConfigurator;
   21   import org.apache.webbeans.util.WebBeansUtil;
   22   
   23   /**
   24    * Implementation of the {@link ManagedBeanCreator}.
   25    * 
   26    * @version $Rev: 794377 $ $Date: 2009-07-15 22:40:48 +0300 (Wed, 15 Jul 2009) $
   27    *
   28    * @param <T> bean type info
   29    */
   30   public class ManagedBeanCreatorImpl<T> extends AbstractInjectedTargetBeanCreator<T> implements ManagedBeanCreator<T>
   31   {
   32   
   33       /**
   34        * Creates a new creator.
   35        * 
   36        * @param managedBean managed bean instance
   37        */
   38       public ManagedBeanCreatorImpl(ManagedBean<T> managedBean)
   39       {
   40           super(managedBean);
   41       }
   42       
   43       
   44       /**
   45        * {@inheritDoc}
   46        */
   47       @Override
   48       public void checkCreateConditions()
   49       {
   50           ManagedBeanConfigurator.checkSimpleWebBeanCondition(getBean().getReturnType());
   51           WebBeansUtil.checkGenericType(getBean());
   52           
   53       }
   54   
   55   
   56       /**
   57        * {@inheritDoc}
   58        */
   59       @Override
   60       public void defineConstructor()
   61       {
   62           if(isDefaultMetaDataProvider())
   63           {
   64               Constructor<T> constructor = WebBeansUtil.defineConstructor(getBean().getReturnType());
   65               getBean().setConstructor(constructor);
   66               DefinitionUtil.addConstructorInjectionPointMetaData(getBean(), constructor);
   67           }
   68           else
   69           {
   70               //TODO
   71           }
   72       }
   73   
   74       /**
   75        * {@inheritDoc}
   76        */
   77       public ManagedBean<T> getBean()
   78       {
   79           return (ManagedBean<T>)super.getBean();
   80       }
   81   }

Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.component.creation » [javadoc | source]