Save This Page
Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.component » [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;
   15   
   16   import java.lang.annotation.Annotation;
   17   import java.lang.reflect.Member;
   18   import java.util.List;
   19   import java.util.Set;
   20   
   21   import javax.enterprise.context.spi.CreationalContext;
   22   import javax.enterprise.inject.spi.Bean;
   23   import javax.enterprise.inject.spi.InjectionPoint;
   24   import javax.enterprise.inject.spi.BeanManager;
   25   
   26   import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
   27   import org.apache.webbeans.intercept.InterceptorData;
   28   
   29   /**
   30    * OWB specific extension of the {@link Bean} interface.
   31    * It is used internally. Do not use it. Instead use {@link AbstractBean}
   32    * for extension.
   33    * 
   34    * @version $Rev: 811507 $ $Date: 2009-09-04 21:18:41 +0300 (Fri, 04 Sep 2009) $
   35    * <T> bean class
   36    */
   37   public abstract class BaseBean<T> implements Bean<T>
   38   {
   39   	/**Bean Manager*/
   40       private final BeanManager manager;
   41   
   42       /**
   43        * Creates a new bean instance with given manager.
   44        * 
   45        * @param manager bean manager
   46        */
   47       protected BaseBean(BeanManager manager)
   48       {
   49           this.manager = manager;
   50       }
   51       
   52       /**
   53        * Gets manager instance
   54        * 
   55        * @return manager instance
   56        */
   57       protected BeanManager getManager()
   58       {
   59           return manager;
   60       }
   61       
   62       /**
   63        * Returns bean's inherited meta data.
   64        * 
   65        * @return inherited meta data.
   66        */
   67       public abstract IBeanInheritedMetaData getInheritedMetaData();
   68       
   69       /**
   70        * Returna deployment type as annotation.
   71        * 
   72        * @return deployment type as annotation
   73        */
   74       public abstract Annotation getType();
   75   
   76       /**
   77        * Sets bean deployment type annotation.
   78        * 
   79        * @param type bean deployment type annotation
   80        */
   81       public abstract void setType(Annotation type);
   82   
   83       /**
   84        * Returns scope type annotation.
   85        * 
   86        * @return scope type annotation
   87        */
   88       public abstract Annotation getImplScopeType();
   89   
   90       /**
   91        * Sets bean scope type annotation.
   92        * 
   93        * @param scopeType bean scope type annotation
   94        */
   95       public abstract void setImplScopeType(Annotation scopeType);
   96   
   97       /**
   98        * Returns bean type.
   99        * 
  100        * @return webbeans type
  101        * @see WebBeansType
  102        */
  103       public abstract WebBeansType getWebBeansType();
  104   
  105       /**
  106        * Adds qualifier.
  107        * 
  108        * @param qualifier bean qualifier
  109        */
  110       public abstract void addQualifier(Annotation qualifier);
  111   
  112       /**
  113        * Adds new stereotype annotation.
  114        * 
  115        * @param stereoType stereotype annotation
  116        */
  117       public abstract void addStereoType(Annotation stereoType);
  118   
  119       /**
  120        * Adds new api type.
  121        * 
  122        * @param apiType api type
  123        */
  124       public abstract void addApiType(Class<?> apiType);
  125       
  126       /**
  127        * Adds new injection point.
  128        * 
  129        * @param injectionPoint injection point
  130        */
  131       public abstract void addInjectionPoint(InjectionPoint injectionPoint);
  132   
  133       /**
  134        * Returns set of qualifier annotations.
  135        * 
  136        * @return set of qualifier annotations
  137        */
  138       public abstract Set<Annotation> getImplQualifiers();
  139   
  140       /**
  141        * Gets stereotypes annotations.
  142        */
  143       public abstract Set<Annotation> getOwbStereotypes();
  144   
  145       /**
  146        * Sets name of the bean.
  147        * 
  148        * @param name bean name
  149        */
  150       public abstract void setName(String name);
  151       
  152       /**
  153        * Gets injection points for given member.
  154        * <p>
  155        * For example, if member is field, it gets all
  156        * injected field's injection points of bean.
  157        * </p>
  158        * @param member java member
  159        * @return injection points for given member
  160        */
  161       public abstract List<InjectionPoint> getInjectionPoint(Member member);
  162   
  163       /**
  164        * Gets precedence
  165        * @return precedence
  166        */
  167       public abstract int getPrecedence();
  168   
  169       /**
  170        * Returns bean class type
  171        * @return bean class type
  172        */
  173       public abstract Class<T> getReturnType();
  174   
  175       /**
  176        * Gets dependent bean at given injection point.
  177        * @param dependentBean dependent bean
  178        * @param injectionPoint injection point of dependent bean
  179        * @return dependent bean
  180        */
  181       public abstract Object getDependent(Bean<?> dependentBean,InjectionPoint injectionPoint);
  182   
  183       /**
  184        * Gets interceptor stack of bean instance.
  185        * @return interceptor stack
  186        */
  187       public abstract List<InterceptorData> getInterceptorStack();
  188   
  189       /**
  190        * Gets decorator stack of bean instance.
  191        * @return decorator stack
  192        */
  193       public abstract List<Object> getDecoratorStack();
  194   
  195       /**
  196        * Sets serializable flag.
  197        * @param serializable flag
  198        */
  199       public abstract void setSerializable(boolean serializable);
  200   
  201       /**
  202        * Set nullable flag.
  203        * @param nullable flag
  204        */
  205       public abstract void setNullable(boolean nullable);
  206       
  207       /**
  208        * Set specialized flag.
  209        * @param specialized flag
  210        */
  211       public abstract void setSpecializedBean(boolean specialized);
  212       
  213       /**
  214        * Returns true if bean is a specialized bean, false otherwise.
  215        * @return true if bean is a specialized bean
  216        */
  217       public abstract boolean isSpecializedBean();
  218       
  219       /**
  220        * Returns creational context of bean instance
  221        * @return creational context of bean instance.
  222        */
  223       public abstract CreationalContext<T> getCreationalContext();
  224       
  225       /**
  226        * Set creational context
  227        * @param creationalContext creational context
  228        */
  229       public abstract void setCreationalContext(CreationalContext<T> creationalContext);
  230   }

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