Class AnnotationUtil


  • public final class AnnotationUtil
    extends Object
    Utilities for processing defined annotations.
    • Method Detail

      • matchDatabaseVendor

        public static boolean matchDatabaseVendor​(DatabaseVendor vendor,
                                                  IfDatabaseVendor annotationValue)
        Checks whether or not the vendor of database match the value of annotation.
        If vendor parameter is null, the result would be true.
        Parameters:
        vendor - The vendor to be checked, must not be null
        annotationValue - The instance of annotation
        Returns:
        true if any matched or nothing is not matched
      • hasJdutResourceAnnotation

        public static boolean hasJdutResourceAnnotation​(Class<?> sourceClass)
        Checks whether or not the class has declare JdutResource on it(directly).
        Parameters:
        sourceClass - The class to be checked
        Returns:
        true if it is declaring the annotation
      • hasJdutResourceAnnotation

        public static boolean hasJdutResourceAnnotation​(Method sourceMethod)
        Checks whether or not the method has declare JdutResource on it(directly).
        Parameters:
        sourceMethod - The method to be checked
        Returns:
        true if it is declaring the annotation
      • buildConductorByConvention

        public static Optional<DuetConductor> buildConductorByConvention​(YamlConductorFactory conductorFactory,
                                                                         Method sourceMethod)
        Builds DuetConductor by naming(using convention) of class and method, the file name would be <class_name>-<method_name>.yaml which should be as same as package of method's class.
        The method must be annotated with JdutResource.
        Parameters:
        conductorFactory - The factory of conductor
        sourceMethod - The method to be tested(recommended)
        Returns:
        The conductor for data
      • buildConductorByConvention

        public static Optional<DuetConductor> buildConductorByConvention​(YamlConductorFactory conductorFactory,
                                                                         Class<?> sourceClass)
        Builds DuetConductor by naming(using convention) of class and method, the file name would be <class_name>.yaml which should be as same as package of class.
        The class must be annotated with JdutResource.
        Parameters:
        conductorFactory - The factory of conductor
        sourceClass - The source of class
        Returns:
        The conductor for data