Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.inject.xml » [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.inject.xml;
   15   
   16   import java.lang.annotation.Annotation;
   17   import java.lang.reflect.Field;
   18   
   19   import javax.enterprise.context.spi.CreationalContext;
   20   
   21   import org.apache.webbeans.component.AbstractBean;
   22   import org.apache.webbeans.exception.WebBeansException;
   23   import org.apache.webbeans.inject.InjectableField;
   24   
   25   public class XMLInjectableField extends InjectableField
   26   {
   27       private XMLInjectionPointModel injectionPointModel = null;
   28   
   29       public XMLInjectableField(Field field, Object instance, AbstractBean<?> owner, XMLInjectionPointModel model,CreationalContext<?> creationalContext)
   30       {
   31           super(field, instance, owner,creationalContext);
   32           this.injectionPointModel = model;
   33       }
   34   
   35       /*
   36        * (non-Javadoc)
   37        * @see org.apache.webbeans.inject.InjectableField#doInjection()
   38        */
   39       @Override
   40       public Object doInjection()
   41       {
   42           Annotation[] anns = new Annotation[this.injectionPointModel.getBindingTypes().size()];
   43           anns = this.injectionPointModel.getBindingTypes().toArray(anns);
   44   
   45           try
   46           {
   47               if (!field.isAccessible())
   48               {
   49                   field.setAccessible(true);
   50               }
   51   
   52               
   53               //field.set(instance, inject(this.injectionPointModel.getInjectionGenericType(), anns));
   54   
   55           }
   56           catch (Exception e)
   57           {
   58               throw new WebBeansException(e);
   59           }
   60   
   61           return null;
   62       }
   63   }

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