Project

General

Profile

« Previous | Next » 

Revision 45e9e404

Added by Andreas Müller almost 9 years ago

minor

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmTypeScanner.java
30 30
    boolean includeAbstract;
31 31
    boolean includeInterfaces;
32 32

  
33
        public CdmTypeScanner(boolean considerAbstract, boolean considerInterfaces) {
34
            super(false);
35
            this.includeAbstract = considerAbstract;
36
            this.includeInterfaces = considerInterfaces;
37
        }
33
    public CdmTypeScanner(boolean considerAbstract, boolean considerInterfaces) {
34
        super(false);
35
        this.includeAbstract = considerAbstract;
36
        this.includeInterfaces = considerInterfaces;
37
    }
38 38

  
39
        public final Collection<Class<? extends T>> scanTypesIn(String basePackage) {
40
            String _basePackage = basePackage == null ? defaultBasePackage : basePackage;
41
            List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
42
            for (BeanDefinition candidate : findCandidateComponents(_basePackage)) {
43
                    Class cls = ClassUtils.resolveClassName(candidate.getBeanClassName(),
44
                            ClassUtils.getDefaultClassLoader());
45
                    classes.add(cls);
46
            }
47
            return classes;
39
    public final Collection<Class<? extends T>> scanTypesIn(String basePackage) {
40
        String _basePackage = basePackage == null ? defaultBasePackage : basePackage;
41
        List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
42
        for (BeanDefinition candidate : findCandidateComponents(_basePackage)) {
43
                Class cls = ClassUtils.resolveClassName(candidate.getBeanClassName(),
44
                        ClassUtils.getDefaultClassLoader());
45
                classes.add(cls);
48 46
        }
47
        return classes;
48
    }
49 49

  
50
        /**
51
         * Determine whether the given bean definition qualifies as candidate.
52
         * <p>The special implementation checks whether the class is concrete
53
         * or abstract or an interface. The latter two conditions depend on
54
         * the state of the two boolean fields includeAnstract, includeInterface.
55
         *
56
         * @param beanDefinition the bean definition to check
57
         * @return whether the bean definition qualifies as a candidate component
58
         */
59
        @Override
60
        protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
61
            return (beanDefinition.getMetadata().isIndependent()
62
                    && (beanDefinition.getMetadata().isConcrete()
63
                      || (includeAbstract && beanDefinition.getMetadata().isAbstract())
64
                      || (includeInterfaces && beanDefinition.getMetadata().isInterface())
65
                     )
66
                    );
67
        }
50
    /**
51
     * Determine whether the given bean definition qualifies as candidate.
52
     * <p>The special implementation checks whether the class is concrete
53
     * or abstract or an interface. The latter two conditions depend on
54
     * the state of the two boolean fields includeAnstract, includeInterface.
55
     *
56
     * @param beanDefinition the bean definition to check
57
     * @return whether the bean definition qualifies as a candidate component
58
     */
59
    @Override
60
    protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
61
        return (beanDefinition.getMetadata().isIndependent()
62
                && (beanDefinition.getMetadata().isConcrete()
63
                  || (includeAbstract && beanDefinition.getMetadata().isAbstract())
64
                  || (includeInterfaces && beanDefinition.getMetadata().isInterface())
65
                 )
66
                );
67
    }
68 68

  
69 69
    }

Also available in: Unified diff