Home » apache-openwebbeans-1.0.0-incubating-M3-sources » org.apache.webbeans.portable » [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.portable;
   15   
   16   import java.util.Collections;
   17   import java.util.HashSet;
   18   import java.util.Set;
   19   
   20   import javax.enterprise.inject.spi.AnnotatedConstructor;
   21   import javax.enterprise.inject.spi.AnnotatedField;
   22   import javax.enterprise.inject.spi.AnnotatedMethod;
   23   import javax.enterprise.inject.spi.AnnotatedType;
   24   
   25   /**
   26    * Implementation of the {@link AnnotatedType} interface.
   27    * 
   28    * @version $Rev: 788942 $ $Date: 2009-06-27 12:21:55 +0300 (Sat, 27 Jun 2009) $
   29    *
   30    * @param <X> class type
   31    */
   32   class AnnotatedTypeImpl<X> extends AbstractAnnotated implements AnnotatedType<X>
   33   {
   34       /**Annotated class*/
   35       private Class<X> annotatedClass;
   36       
   37       /**Constructors*/
   38       private Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>();
   39       
   40       /**Fields*/
   41       private Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>();
   42       
   43       /**Methods*/
   44       private Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>();
   45       
   46       /**
   47        * Creates a new instance.
   48        * 
   49        * @param annotatedClass class
   50        */
   51       AnnotatedTypeImpl(Class<X> annotatedClass)
   52       {
   53           super(annotatedClass);        
   54           this.annotatedClass = annotatedClass;     
   55           
   56           setAnnotations(annotatedClass.getDeclaredAnnotations());
   57       }
   58       
   59       /**
   60        * Adds new annotated constructor.
   61        * 
   62        * @param constructor new constructor
   63        */
   64       void addAnnotatedConstructor(AnnotatedConstructor<X> constructor)
   65       {
   66           this.constructors.add(constructor);
   67       }
   68       
   69       /**
   70        * Adds new annotated field.
   71        * 
   72        * @param constructor new field
   73        */
   74       void addAnnotatedField(AnnotatedField<? super X> field)
   75       {
   76           this.fields.add(field);
   77       }
   78   
   79       /**
   80        * Adds new annotated method.
   81        * 
   82        * @param constructor new method
   83        */
   84       void addAnnotatedMethod(AnnotatedMethod<? super X> method)
   85       {
   86           this.methods.add(method);
   87       }    
   88       
   89       /**
   90        * {@inheritDoc}
   91        */
   92       @Override
   93       public Set<AnnotatedConstructor<X>> getConstructors()
   94       {
   95           return Collections.unmodifiableSet(this.constructors);
   96       }
   97   
   98       /**
   99        * {@inheritDoc}
  100        */    
  101       @Override
  102       public Set<AnnotatedField<? super X>> getFields()
  103       {
  104           return Collections.unmodifiableSet(this.fields);
  105       }
  106   
  107       /**
  108        * {@inheritDoc}
  109        */    
  110       @Override
  111       public Class<X> getJavaClass()
  112       {
  113           return this.annotatedClass;
  114       }
  115   
  116       /**
  117        * {@inheritDoc}
  118        */    
  119       @Override
  120       public Set<AnnotatedMethod<? super X>> getMethods()
  121       {
  122           return Collections.unmodifiableSet(this.methods);
  123       }
  124   
  125   }

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