Package moa.core

Class AutoClassDiscovery


  • public class AutoClassDiscovery
    extends Object
    Class for discovering classes via reflection in the java class path.
    If analyzing of classpath fails, it falls back on reading class names from file list CLASS_LIST as resource stream.
    Author:
    Richard Kirkby (rkirkby@cs.waikato.ac.nz)
    • Field Detail

      • cachedClassNames

        protected static final Map<String,​String[]> cachedClassNames
      • m_Cache

        protected static nz.ac.waikato.cms.locator.ClassCache m_Cache
    • Constructor Detail

      • AutoClassDiscovery

        public AutoClassDiscovery()
    • Method Detail

      • initCache

        protected static void initCache()
        Initializes the class cache
      • getAllClassNames

        public static List<String> getAllClassNames()
        Returns all class names stored in the cache.
        Returns:
        the class names
      • findClassNames

        public static String[] findClassNames​(String packageNameToSearch)
      • findClassesOfType

        public static Class[] findClassesOfType​(String packageNameToSearch,
                                                Class<?> typeDesired)
      • isPublicConcreteClassOfType

        public static boolean isPublicConcreteClassOfType​(String className,
                                                          Class<?> typeDesired)
      • hasEmptyConstructor

        public static boolean hasEmptyConstructor​(Class<?> type)
      • main

        public static void main​(String[] args)
                         throws Exception
        Outputs all class names below "moa" either to stdout or to the file provided as first argument.
        Parameters:
        args - optional file for storing the classnames
        Throws:
        Exception - if writing to file fails