1 21 package com.db4o.config.annotations.reflect; 22 23 import java.lang.annotation.Annotation ; 24 import java.lang.reflect.AnnotatedElement ; 25 import java.lang.reflect.Field ; 26 27 import com.db4o.config.annotations.Indexed; 28 29 32 public class IndexedFactory implements Db4oConfiguratorFactory { 33 34 public Db4oConfigurator configuratorFor(AnnotatedElement element, 35 Annotation annotation) { 36 if (!annotation.annotationType().equals(Indexed.class)) { 37 return null; 38 } 39 String fieldName=null; 40 String className=null; 41 if(element instanceof Field ) { 42 Field field=(Field )element; 43 fieldName=field.getName(); 44 className=field.getDeclaringClass().getName(); 45 } 46 else { 47 return null; 48 } 49 50 return new IndexedConfigurator(className,fieldName); 51 } 52 53 } 54 | Popular Tags |