All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.elephantdrummer.tool.reflect.ScannerAfterJobExecution Maven / Gradle / Ivy

The newest version!
package com.elephantdrummer.tool.reflect;

import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;

import com.elephantdrummer.annotation.flow.AfterDrummerJobNamed;
import com.elephantdrummer.executor.base.structure.MethodToInvoke;
import com.elephantdrummer.scope.DrummerObservable;

/**
 * Copyright 2018 Elephant Software Klaudiusz Wojtkowiak e-mail: [email protected]
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0 
 *  
 *  Unless required by applicable law or agreed to in writing, software 
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
 */
public interface ScannerAfterJobExecution {
	
	  public static List getAfterJobExecutionMethods(DrummerObservable dob){
		  
		  List rv=new LinkedList();
		  
		  for (Method m:dob.getClass().getMethods()) {
			  if (m.isAnnotationPresent(AfterDrummerJobNamed.class)==false) {
				  continue;
			  }
			 
//			  if (m.isAccessible()==false ) {
//				  continue;
//			  }
			  if (m.getParameterTypes().length>0) {
				  continue;
			  }

			  
			  AfterDrummerJobNamed a=m.getAnnotation(AfterDrummerJobNamed.class);
			  
			  try {
				rv.add(new MethodToInvoke(a.name(), m, dob, a.priority()));
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		  }
		  return rv;
	  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy