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