
org.seedstack.business.data.DataImporter Maven / Gradle / Ivy
/*
* Copyright © 2013-2024, The SeedStack authors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.business.data;
import java.util.stream.Stream;
/**
* Implement this interface to create a data set importer that will handle objects of a specific
* type. A data importer must be marked with a {@link DataSet} annotation to be recognized.
*
* @param the type this data importer handles.
*/
public interface DataImporter {
/**
* This method is used to determine if a data importer should be automatically initialized with
* data.
*
* @return true if already initialized (and as such won't be automatically initialized), false
* otherwise.
*/
boolean isInitialized();
/**
* This method is called when the backing persistence must be cleared before import.
*/
void clear();
/**
* This method is called when a stream of objects is ready to import.
*
* @param data the object to import.
*/
void importData(Stream data);
/**
* Returns the data class managed by the importer.
*
* @return the data class.
*/
Class getImportedClass();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy