From d3b500b342053d6e40a1ffb254d7008f23067c95 Mon Sep 17 00:00:00 2001 From: Pierre Villard Date: Thu, 19 Mar 2026 16:49:34 +0100 Subject: [PATCH] NIFI-15733 - Add CapabilityTag annotation --- .../documentation/CapabilityTag.java | 54 +++++++++++++++++++ .../documentation/CapabilityTags.java | 36 +++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/main/java/org/apache/nifi/annotation/documentation/CapabilityTag.java create mode 100644 src/main/java/org/apache/nifi/annotation/documentation/CapabilityTags.java diff --git a/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTag.java b/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTag.java new file mode 100644 index 0000000..21656bc --- /dev/null +++ b/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTag.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.annotation.documentation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to a {@link org.apache.nifi.processor.Processor Processor}, + * {@link org.apache.nifi.controller.ControllerService ControllerService}, + * {@link org.apache.nifi.parameter.ParameterProvider ParameterProvider}, + * {@link org.apache.nifi.flowanalysis.FlowAnalysisRule FlowAnalysisRule}, or + * {@link org.apache.nifi.reporting.ReportingTask ReportingTask} in order to + * associate a key-value pair with the component. These tags do not affect the + * component in any way but serve as additional documentation and can be + * included in the extension manifest and generated documentation. + */ +@Documented +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Repeatable(CapabilityTags.class) +public @interface CapabilityTag { + + /** + * @return the key of the capability tag + */ + String key(); + + /** + * @return the value of the capability tag + */ + String value(); +} diff --git a/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTags.java b/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTags.java new file mode 100644 index 0000000..f4f10ef --- /dev/null +++ b/src/main/java/org/apache/nifi/annotation/documentation/CapabilityTags.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.annotation.documentation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * An enclosing annotation that can be used in order to use the {@link CapabilityTag} annotation in a repeated manner. + */ +@Documented +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface CapabilityTags { + CapabilityTag[] value(); +}