001/** 002 * Copyright (C) 2006-2026 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.api.processor; 017 018import lombok.Getter; 019import lombok.RequiredArgsConstructor; 020 021/** 022 * A record tagged with its target output connection name. 023 * Used with {@link MultiOutputIterator} to route individual records to 024 * specific output connections from a single streaming iterator. 025 * 026 * @param <T> the record type 027 */ 028@Getter 029@RequiredArgsConstructor 030public class TaggedOutput<T> { 031 032 /** 033 * The name of the output connection this record should be routed to. 034 * Use {@code "__default__"} or {@code "FLOW"} for the default output. 035 */ 036 private final String outputName; 037 038 /** The record to emit to the named output. */ 039 private final T record; 040 041 /** 042 * Convenience factory method. 043 * 044 * @param outputName the target output connection name 045 * @param record the record to emit 046 * @param <T> the record type 047 * @return a new TaggedOutput 048 */ 049 public static <T> TaggedOutput<T> of(final String outputName, final T record) { 050 return new TaggedOutput<>(outputName, record); 051 } 052}