001/**
002 * Copyright (C) 2006-2024 Talend Inc. - www.talend.com
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.talend.sdk.component.runtime.manager.chain;
017
018import java.util.Iterator;
019import java.util.List;
020
021import org.talend.sdk.component.runtime.input.Input;
022import org.talend.sdk.component.runtime.input.Mapper;
023
024import lombok.RequiredArgsConstructor;
025
026@RequiredArgsConstructor
027public final class ChainedMapper implements Mapper {
028
029    private final Mapper root;
030
031    private final Iterator<Mapper> iterator;
032
033    @Override
034    public long assess() {
035        throw new UnsupportedOperationException();
036    }
037
038    @Override
039    public List<Mapper> split(final long desiredSize) {
040        throw new UnsupportedOperationException();
041    }
042
043    @Override
044    public Input create() {
045        return new ChainedInput(this);
046    }
047
048    @Override
049    public boolean isStream() {
050        return false;
051    }
052
053    @Override
054    public String plugin() {
055        return root.plugin();
056    }
057
058    @Override
059    public String rootName() {
060        return root.rootName();
061    }
062
063    @Override
064    public String name() {
065        return root.name();
066    }
067
068    @Override
069    public void start() {
070        // no-op: already done for the split
071    }
072
073    @Override
074    public void stop() {
075        // no-op: must be handled outside this
076    }
077
078    Iterator<Mapper> getIterator() {
079        return iterator;
080    }
081}