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

io.aubay.fase.maven.plugin.data.spi.AbstractDataTransformer Maven / Gradle / Ivy

There is a newer version: 0.3.7
Show newest version
package io.aubay.fase.maven.plugin.data.spi;

/*-
 * #%L
 * fase-maven-plugin Maven Plugin
 * %%
 * Copyright (C) 2018 - 2019 Aubay
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import java.util.List;

import io.aubay.fase.maven.plugin.FaseRow;

public abstract class AbstractDataTransformer {

	public String id = "default";
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getId() {
		return this.id;
	}

	public List> transform(FaseRow row){
		if(row==null) {
			throw new IllegalArgumentException("row parameter CANNOT BE NULL");
		}
		
		if(!row.isValid()) {
			throw new IllegalArgumentException("row is NOT VALID. Please check for logs above to find reason.");
		}
		
		if(!validateFaseRow(row)) {
			throw new IllegalArgumentException("row is NOT VALID for dataTransformer used '" + this.getClass().getName() + "'. Please check for logs above to find reason.");
		}
		
		return transformRow(row);
	}
	
	public abstract boolean supportsFormat(String dataFileFormat);
	protected abstract boolean validateFaseRow(FaseRow row);
	protected abstract List> transformRow(FaseRow row);
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy