KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > nuts > annotations > AnnotationFilteredPropertiesInjector


1 package jfun.yan.nuts.annotations;
2 import java.beans.IntrospectionException JavaDoc;
3 import java.lang.annotation.Annotation JavaDoc;
4
5 import jfun.util.beans.BeanType;
6 import jfun.yan.FilteredPropertiesInjector;
7 import jfun.yan.PropertiesInjector;
8 import jfun.yan.util.Utils;
9
10 /**
11  * The PropertiesInjector that injects properties with a certain annotation type.
12  * <p>
13  * @author Ben Yu
14  * Dec 15, 2005 10:33:49 PM
15  */

16 public class AnnotationFilteredPropertiesInjector
17 extends FilteredPropertiesInjector{
18    
19   /**
20    * Create an instance of AnnotationFilteredPropertiesInjector.
21    * If type is null, dynamic binding will be used.
22    * @param type the bean class.
23    * @param annotation the annotation type.
24    * @return the instance.
25    * @throws IntrospectionException
26    */

27   public static PropertiesInjector instance(Class JavaDoc type,
28       Class JavaDoc<? extends Annotation JavaDoc> annotation)
29   throws IntrospectionException JavaDoc{
30     final BeanType bt = Utils.toBeanType(type);
31     return new AnnotationFilteredPropertiesInjector(bt, annotation);
32   }
33   /**
34    * Create an instance of AnnotationFilteredPropertiesInjector.
35    * @param btype the BeanType instance. null for dynamic binding.
36    * @param annotation the annotation type.
37    */

38   public AnnotationFilteredPropertiesInjector(final BeanType btype,
39       final Class JavaDoc<? extends Annotation JavaDoc> annotation){
40     super(btype, new AnnotationMemberPredicate(annotation));
41   }
42 }
43
Popular Tags