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

org.jpmml.model.visitors.VisitorBattery Maven / Gradle / Ivy

There is a newer version: 1.6.6
Show newest version
/*
 * Copyright (c) 2018 Villu Ruusmann
 */
package org.jpmml.model.visitors;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;

import org.dmg.pmml.Visitable;
import org.dmg.pmml.Visitor;

public class VisitorBattery extends ArrayList> {

	public void applyTo(Visitable visitable){
		List> visitorClazzes = this;

		for(Class visitorClazz : visitorClazzes){
			Visitor visitor;

			try {
				Constructor constructor = visitorClazz.getDeclaredConstructor();

				visitor = constructor.newInstance();
			} catch(ReflectiveOperationException roe){
				throw new RuntimeException(roe);
			}

			visitor.applyTo(visitable);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy