summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java
blob: b5be7a094a5b41087cdc12ab0c0c5ecc01f54863 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.openslx.virtualization.configuration.transformation;

/**
 * Represents a transformation operation that transforms (alters) a given configuration with
 * specified input arguments and returns no result.
 * 
 * @author Manuel Bentele
 * @version 1.0
 *
 * @param <T> type of the configuration which will be transformed.
 * @param <R> type of input arguments for the transformation.
 */
@FunctionalInterface
public interface TransformationFunction<T, R>
{
	/**
	 * Transforms a given configuration with the specified input arguments.
	 * 
	 * @param config configuration which will be transformed.
	 * @param args input arguments for the transformation.
	 * 
	 * @throws TransformationException transformation of the configuration failed.
	 */
	public void transform( T config, R args ) throws TransformationException;

	/**
	 * Applies the transformation function {@link #transform(Object, Object)} to the given
	 * configuration and specified input arguments.
	 * 
	 * @param config configuration which will be transformed.
	 * @param args input arguments for the transformation.
	 * 
	 * @throws TransformationException transformation of the configuration failed.
	 */
	public default void apply( T config, R args ) throws TransformationException
	{
		this.transform( config, args );
	}
}