Ignore:
Timestamp:
08/14/10 11:12:43 (22 months ago)
Author:
kasper
Message:

limited possibility of @Configured and @Provided to fields in order to make it easy to also get value of properties through PropertyDescriptor?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • AnalyzerBeans/trunk/src/main/java/org/eobjects/analyzer/descriptors/AbstractBeanDescriptor.java

    r971 r974  
    5252                        Configured configuredAnnotation = field 
    5353                                        .getAnnotation(Configured.class); 
     54                        Provided providedAnnotation = field.getAnnotation(Provided.class); 
     55 
     56                        if (configuredAnnotation != null && providedAnnotation != null) { 
     57                                throw new DescriptorException( 
     58                                                "The field " 
     59                                                                + field 
     60                                                                + " is annotated with both @Configured and @Provided, which are mutually exclusive."); 
     61                        } 
     62 
    5463                        if (configuredAnnotation != null) { 
    5564                                if (!field.isAnnotationPresent(Inject.class)) { 
     
    6271                        } 
    6372 
    64                         Provided providedAnnotation = field.getAnnotation(Provided.class); 
    6573                        if (providedAnnotation != null) { 
    6674                                if (!field.isAnnotationPresent(Inject.class)) { 
     
    8795                Method[] methods = beanClass.getDeclaredMethods(); 
    8896                for (Method method : methods) { 
    89                         Configured configuredAnnotation = method 
    90                                         .getAnnotation(Configured.class); 
    91                         if (configuredAnnotation != null) { 
    92                                 if (!method.isAnnotationPresent(Inject.class)) { 
    93                                         logger.warn( 
    94                                                         "No @Inject annotation found for @Configured method: {}", 
    95                                                         method); 
    96                                 } 
    97                                 _configuredProperties.add(new ConfiguredPropertyDescriptorImpl( 
    98                                                 method)); 
    99                         } 
    100  
    101                         Provided providedAnnotation = method.getAnnotation(Provided.class); 
    102                         if (providedAnnotation != null) { 
    103                                 if (!method.isAnnotationPresent(Inject.class)) { 
    104                                         logger.warn( 
    105                                                         "No @Inject annotation found for @Provided method: {}", 
    106                                                         method); 
    107                                 } 
    108                                 _providedProperties.add(new ProvidedPropertyDescriptorImpl( 
    109                                                 method)); 
    110                         } 
    111  
    11297                        Initialize initializeAnnotation = method 
    11398                                        .getAnnotation(Initialize.class); 
Note: See TracChangeset for help on using the changeset viewer.