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

cdc.mf.transform.MfModelTransformer Maven / Gradle / Ivy

There is a newer version: 0.41.0
Show newest version
package cdc.mf.transform;

import cdc.mf.model.MfModel;

/**
 * Interface used to locally transform a {@link MfModel model}.
 * 

* For a deep transformation, use {@link MfTransformer}. * * @author Damien Carbonne */ @FunctionalInterface public interface MfModelTransformer { /** * Converts a source model to a target one. * * @param srcModel The source model. * @return The target model. */ public MfModel transform(MfModel srcModel); /** * @return An instance of {@link MfModelTransformer} that duplicates the source model. */ public static MfModelTransformer cloner() { return MfModel::duplicate; } /** * @param fixer The model fixer. * @return An instance of {@link MfModelTransformer} that duplicates the source model and then fix it. */ public static MfModelTransformer of(MfElementFixer fixer) { return srcModel -> { final MfModel.Builder tgtBuilder = MfModel.builder(); srcModel.set(tgtBuilder); fixer.fix(srcModel, tgtBuilder); return tgtBuilder.build(); }; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy