Class ClassScanner

java.lang.Object
org.qiunet.utils.scanner.ClassScanner
All Implemented Interfaces:
IApplicationContext

public final class ClassScanner extends Object implements IApplicationContext
Author:
qiunet Created on 17/1/23 18:22.
  • Method Details

    • getInstance

      public static ClassScanner getInstance(ScannerType... scannerType)
    • scanner

      public void scanner(String... packetPrefix)
    • addParam

      public <T> ClassScanner addParam(ArgumentKey<T> argKey, T obj)
      添加一些参数给applicationContext
      Type Parameters:
      T -
      Parameters:
      argKey -
      obj -
      Returns:
    • getSubTypesOf

      public <T> Set<Class<? extends T>> getSubTypesOf(Class<T> type)
      Description copied from interface: IApplicationContext
      gets all sub types in hierarchy of a given type

      depends on SubTypesScanner configured

      Specified by:
      getSubTypesOf in interface IApplicationContext
    • getTypesAnnotatedWith

      public Set<Class<?>> getTypesAnnotatedWith(Class<? extends Annotation> annotation)
      Description copied from interface: IApplicationContext
      get types annotated with a given annotation, both classes and annotations

      Inherited is not honored by default.

      when honoring @Inherited, meta-annotation should only effect annotated super classes and its sub types

      Note that this (@Inherited) meta-annotation type has no effect if the annotated type is used for anything other then a class. Also, this meta-annotation causes annotations to be inherited only from superclasses; annotations on implemented interfaces have no effect.

      depends on TypeAnnotationsScanner and SubTypesScanner configured

      Specified by:
      getTypesAnnotatedWith in interface IApplicationContext
    • getFieldsAnnotatedWith

      public Set<Field> getFieldsAnnotatedWith(Class<? extends Annotation> annotation)
      Description copied from interface: IApplicationContext
      get all fields annotated with a given annotation

      depends on FieldAnnotationsScanner configured

      Specified by:
      getFieldsAnnotatedWith in interface IApplicationContext
    • getMethodsAnnotatedWith

      public Set<Method> getMethodsAnnotatedWith(Class<? extends Annotation> annotation)
      Description copied from interface: IApplicationContext
      get all methods annotated with a given annotation

      depends on MethodAnnotationsScanner configured

      Specified by:
      getMethodsAnnotatedWith in interface IApplicationContext
    • isPrepare

      public boolean isPrepare(ScannerType scannerType)
      Description copied from interface: IApplicationContext
      是否有扫描 scannerType
      Specified by:
      isPrepare in interface IApplicationContext
      Returns:
    • getInstanceOfClass

      public Object getInstanceOfClass(Class clazz, Object... params)
      Description copied from interface: IApplicationContext
      返回class的对象 可以是自身持有对象的单例 没有就new 一个.
      Specified by:
      getInstanceOfClass in interface IApplicationContext
      Returns: