
science.aist.jack.general.transformer.Transformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jack Show documentation
Show all versions of jack Show documentation
A collection of useful Java extensions
/*
* Copyright (c) 2020 the original author or authors.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 https://mozilla.org/MPL/2.0/.
*/
package science.aist.jack.general.transformer;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* Generic interface for a bidirectional Transformer between a domain class and a TO class or collections of those classes
*
* @param Item to be transferred to TO
* @param TO to be transferred to Item
* @author Oliver Krauss
* @author Christoph Praschl
* @since 2.0
*/
@SuppressWarnings("java:S119") // Naming of type arguments
public interface Transformer extends ForwardTransformer, BackwardTransformer,
ForwardCollectionTransformer, BackwardCollectionTransformer {
@Override
default Collection transformToCollection(Collection c) {
return c.stream().map(this::transformTo).collect(Collectors.toList());
}
@Override
default Collection transformFromCollection(Collection f) {
return f.stream().map(this::transformFrom).collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy