Beispiel #1
0
 public static List<Job> extractJobsFromScheduled(Scheduled scheduled) {
   Method[] methods = scheduled.getClass().getMethods();
   List<Job> listOfJobs = new ArrayList<>();
   for (Method method : methods) {
     Every every = method.getAnnotation(Every.class);
     if (every != null) {
       try {
         listOfJobs.add(new Job(scheduled, method, every.value()));
       } catch (IllegalArgumentException e) {
         LOGGER.error(
             "Cannot parse the period '{}' from scheduled method {}.{}",
             every.value(),
             scheduled.getClass().getName(),
             method.getName(),
             e);
       }
     }
   }
   return listOfJobs;
 }