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

com.technophobia.substeps.ant.AntExecutionConfig Maven / Gradle / Ivy

package com.technophobia.substeps.ant;

import java.util.ArrayList;
import java.util.List;

import com.technophobia.substeps.runner.ExecutionConfig;

public class AntExecutionConfig extends ExecutionConfig {
	
	private List stepImplementationClassNames = new ArrayList();
	private List initialisationClasses = new ArrayList();
	
	public List> getStepImplementationClasses() {
		ClassLoader loader = this.getClass().getClassLoader();
		
		List> classes = new ArrayList>();
		try {
			StepImplementationClassNames theStepImplementationClassNames = this.stepImplementationClassNames.get(0);
			
			for (Param clazz : theStepImplementationClassNames.getParams()) {
				classes.add(loader.loadClass(clazz.toString()));
			}
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return classes;
	}
	
	public Class[] getInitialisationClasses() {
		ClassLoader loader = this.getClass().getClassLoader();
		
		Class[] classes = new Class[this.initialisationClasses.size()];
		try {
			InitialisationClass theInitialisationClassList = this.initialisationClasses.get(0);
			
			int i = 0;
			for (Param clazz : theInitialisationClassList.getParams()) {
				classes[i++] = loader.loadClass(clazz.toString());
			}
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return classes;
	}

	public void addConfiguredStepImplementationClassNames(StepImplementationClassNames s) {
		this.stepImplementationClassNames.add(s);
	}

	public void addConfiguredInitialisationClass(InitialisationClass ic) {
		this.initialisationClasses.add(ic);
	}
	
	
	//
	// Nested simple types
	//
	
	public static class ListOfClasses {
		private List params = new ArrayList();
		
		public void addConfiguredParam(Param param) {
			this.params.add(param);
		}
		
		public List getParams() {
			return this.params;
		}
	}
	
	public static class StepImplementationClassNames extends ListOfClasses{
		//
	}
	
	public static class InitialisationClass extends ListOfClasses{
		//
	}
	
	public static class Param {
		private String value;

		public String getText() {
			return value;
		}

		public void addText(String value) {
			this.value = value;
		}
		
		public String toString() {
			return this.value;
		}
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy