001// Copyright 2010, 2011 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.func;
016
017/**
018 * Interface for operation {@link Flow#map(Mapper)} to define how Flow elements are mapped from one type
019 * to another (or otherwise transformed).
020 * <p>
021 * This changed in 5.3 from an abstract base class to an interface.
022 * 
023 * @since 5.2.0
024 * @param <S>
025 *            type of source flow
026 * @param <T>
027 *            type of target (output) flow
028 */
029public interface Mapper<S, T>
030{
031    /**
032     * Implemented in subclasses to map an element from the source flow to an element of the target
033     * flow.
034     */
035    T map(S element);
036}