001/**
002 * Copyright (C) 2006-2022 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.component;
017
018import static java.lang.annotation.RetentionPolicy.RUNTIME;
019
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Repeatable;
022import java.lang.annotation.Retention;
023import java.lang.annotation.RetentionPolicy;
024import java.lang.annotation.Target;
025
026import org.talend.sdk.component.api.meta.Documentation;
027
028/**
029 * Use to group {@link AfterVariable} annotations.
030 * Can be helpful either if you can't use {@link AfterVariable} as repeatable annotations or just to group annotations.
031 *
032 * Note. This functionality is for the Studio only.
033 */
034@Documentation("Declare the group of after variable `@AfterVariable`, "
035        + "only supported on components - `@PartitionMapper`, `@Processor`, `@Emitter`."
036        + "The functionality is for the Studio only.")
037@Target({ ElementType.TYPE })
038@Retention(RetentionPolicy.RUNTIME)
039public @interface AfterVariables {
040
041    AfterVariable[] value();
042
043    /**
044     * Declare after variable for the component.
045     *
046     * Put annotation on {@link org.talend.sdk.component.api.input.Emitter},
047     * {@link org.talend.sdk.component.api.input.PartitionMapper},
048     * {@link org.talend.sdk.component.api.processor.Processor} to declare after variables
049     *
050     * Note. This functionality is for the Studio only.
051     */
052    @Documentation("Declare the after variable, "
053            + "only supported on components - `@PartitionMapper`, `@Processor`, `@Emitter`."
054            + "The functionality is for the Studio only.")
055    @Repeatable(AfterVariables.class)
056    @Target(ElementType.TYPE)
057    @Retention(RetentionPolicy.RUNTIME)
058    @interface AfterVariable {
059
060        /**
061         * @return studio name for variable (like: NB_LINE)
062         */
063        String value();
064
065        /**
066         * @return description of the variable. If it's an empty the key value might be used instead
067         */
068        String description() default "";
069
070        /**
071         * @return type of variable
072         */
073        Class<?> type() default String.class;
074    }
075
076    /**
077     * Mark method that returns container with after variables.
078     *
079     * Note. This functionality is for the Studio only.
080     */
081    @Documentation("Mark method that returns container with after variables map, "
082            + "only supported on components - `@PartitionMapper`, `@Processor`, `@Emitter`."
083            + "The functionality is for the Studio only.")
084    @Target(ElementType.METHOD)
085    @Retention(RUNTIME)
086    @interface AfterVariableContainer {
087    }
088}