Package guru.mikelue.jdut.annotation
Class AnnotationUtil
- java.lang.Object
-
- guru.mikelue.jdut.annotation.AnnotationUtil
-
public final class AnnotationUtil extends Object
Utilities for processing defined annotations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<DuetConductor>buildConductorByConvention(YamlConductorFactory conductorFactory, Class<?> sourceClass)BuildsDuetConductorby naming(using convention) of class and method, the file name would be<class_name>.yamlwhich should be as same as package of class.
The class must be annotated withJdutResource.static Optional<DuetConductor>buildConductorByConvention(YamlConductorFactory conductorFactory, Method sourceMethod)BuildsDuetConductorby naming(using convention) of class and method, the file name would be<class_name>-<method_name>.yamlwhich should be as same as package of method's class.
The method must be annotated withJdutResource.static booleanhasJdutResourceAnnotation(Class<?> sourceClass)Checks whether or not the class has declareJdutResourceon it(directly).static booleanhasJdutResourceAnnotation(Method sourceMethod)Checks whether or not the method has declareJdutResourceon it(directly).static booleanmatchDatabaseVendor(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.
-
-
-
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 nullannotationValue- 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 declareJdutResourceon 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 declareJdutResourceon 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)
BuildsDuetConductorby naming(using convention) of class and method, the file name would be<class_name>-<method_name>.yamlwhich should be as same as package of method's class.
The method must be annotated withJdutResource.- Parameters:
conductorFactory- The factory of conductorsourceMethod- The method to be tested(recommended)- Returns:
- The conductor for data
-
buildConductorByConvention
public static Optional<DuetConductor> buildConductorByConvention(YamlConductorFactory conductorFactory, Class<?> sourceClass)
BuildsDuetConductorby naming(using convention) of class and method, the file name would be<class_name>.yamlwhich should be as same as package of class.
The class must be annotated withJdutResource.- Parameters:
conductorFactory- The factory of conductorsourceClass- The source of class- Returns:
- The conductor for data
-
-