summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java')
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java
new file mode 100644
index 0000000..b5be7a0
--- /dev/null
+++ b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationFunction.java
@@ -0,0 +1,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 );
+ }
+}