You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2020/02/23 23:52:03 UTC

[logging-log4j2] 01/03: Add v3 annotation API

This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch mean-bean-machine
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 2344d35bc1a2322c099b14c4155a18e514a655e5
Author: Matt Sicker <bo...@gmail.com>
AuthorDate: Sun Feb 23 17:43:12 2020 -0600

    Add v3 annotation API
    
    Signed-off-by: Matt Sicker <bo...@gmail.com>
---
 .../apache/logging/log4j/plugins/api/AliasFor.java | 33 +++++++++++++
 .../apache/logging/log4j/plugins/api/Default.java  | 56 ++++++++++++++++++++++
 .../apache/logging/log4j/plugins/api/Disposes.java | 31 ++++++++++++
 .../apache/logging/log4j/plugins/api/Ignore.java   | 33 +++++++++++++
 .../apache/logging/log4j/plugins/api/Inject.java   | 30 ++++++++++++
 .../apache/logging/log4j/plugins/api/Named.java    | 35 ++++++++++++++
 .../logging/log4j/plugins/api/PostConstruct.java   | 30 ++++++++++++
 .../logging/log4j/plugins/api/PreDestroy.java      | 30 ++++++++++++
 .../apache/logging/log4j/plugins/api/Produces.java | 30 ++++++++++++
 .../logging/log4j/plugins/api/PrototypeScoped.java | 31 ++++++++++++
 .../apache/logging/log4j/plugins/api/Provider.java | 22 +++++++++
 .../logging/log4j/plugins/api/QualifierType.java   | 31 ++++++++++++
 .../logging/log4j/plugins/api/ScopeType.java       | 31 ++++++++++++
 .../logging/log4j/plugins/api/SingletonScoped.java | 30 ++++++++++++
 .../logging/log4j/plugins/api/Stereotype.java      | 34 +++++++++++++
 15 files changed, 487 insertions(+)

diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/AliasFor.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/AliasFor.java
new file mode 100644
index 0000000..b7541d8
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/AliasFor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+// TODO: documentation around where this can be applied
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+@Documented
+public @interface AliasFor {
+    Class<? extends Annotation> value();
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Default.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Default.java
new file mode 100644
index 0000000..4ec2398
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Default.java
@@ -0,0 +1,56 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@QualifierType
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+// default qualifier unless qualifier besides @Named is present
+public @interface Default {
+    @SuppressWarnings("ClassExplicitlyAnnotation")
+    class Literal implements Default, Annotation {
+        @Override
+        public Class<? extends Annotation> annotationType() {
+            return Default.class;
+        }
+
+        @Override
+        public boolean equals(final Object o) {
+            return this == o || o instanceof Default;
+        }
+
+        @Override
+        public int hashCode() {
+            return Default.class.hashCode();
+        }
+
+        @Override
+        public String toString() {
+            return "@Default";
+        }
+    }
+
+    Default INSTANCE = new Literal();
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Disposes.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Disposes.java
new file mode 100644
index 0000000..d89873a
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Disposes.java
@@ -0,0 +1,31 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+// TODO: validate this is not allowed on static methods
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@Documented
+public @interface Disposes {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Ignore.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Ignore.java
new file mode 100644
index 0000000..3c97846
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Ignore.java
@@ -0,0 +1,33 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+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;
+
+// TODO: documentation around where this can be applied
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Documented
+@Inherited
+public @interface Ignore {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Inject.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Inject.java
new file mode 100644
index 0000000..343df0c
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Inject.java
@@ -0,0 +1,30 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD})
+@Documented
+public @interface Inject {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Named.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Named.java
new file mode 100644
index 0000000..b4f67e7
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Named.java
@@ -0,0 +1,35 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import org.apache.logging.log4j.plugins.name.NameProvider;
+import org.apache.logging.log4j.plugins.name.NamedQualifierNameProvider;
+import org.apache.logging.log4j.util.Strings;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@QualifierType
+@NameProvider(NamedQualifierNameProvider.class)
+public @interface Named {
+    // TODO: consider supporting String[] for listing aliases? (or see @Alternative?)
+    String value() default Strings.EMPTY;
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PostConstruct.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PostConstruct.java
new file mode 100644
index 0000000..ad5263a
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PostConstruct.java
@@ -0,0 +1,30 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Documented
+public @interface PostConstruct {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PreDestroy.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PreDestroy.java
new file mode 100644
index 0000000..4d6abaa
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PreDestroy.java
@@ -0,0 +1,30 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Documented
+public @interface PreDestroy {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Produces.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Produces.java
new file mode 100644
index 0000000..213ba26
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Produces.java
@@ -0,0 +1,30 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE_USE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Produces {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PrototypeScoped.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PrototypeScoped.java
new file mode 100644
index 0000000..43a2934
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/PrototypeScoped.java
@@ -0,0 +1,31 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+@ScopeType
+// TODO: consider renaming to DefaultScoped or DependentScoped
+public @interface PrototypeScoped {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Provider.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Provider.java
new file mode 100644
index 0000000..0407c5c
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Provider.java
@@ -0,0 +1,22 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+public interface Provider<T> {
+    T get();
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/QualifierType.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/QualifierType.java
new file mode 100644
index 0000000..9fc160a
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/QualifierType.java
@@ -0,0 +1,31 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface QualifierType {
+    // default is @Default
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/ScopeType.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/ScopeType.java
new file mode 100644
index 0000000..ce3a8d4
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/ScopeType.java
@@ -0,0 +1,31 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+// essentially the same as @Scope and @NormalScope combined; no distinction necessary here
+@Target(ElementType.ANNOTATION_TYPE) // on an annotation typically with @Target(TYPE), but we use static factory methods
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ScopeType {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/SingletonScoped.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/SingletonScoped.java
new file mode 100644
index 0000000..434c03b
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/SingletonScoped.java
@@ -0,0 +1,30 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Inherited
+@ScopeType
+public @interface SingletonScoped {
+}
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Stereotype.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Stereotype.java
new file mode 100644
index 0000000..280ebb3
--- /dev/null
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/api/Stereotype.java
@@ -0,0 +1,34 @@
+/*
+ * 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.logging.log4j.plugins.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks an annotation type as a stereotype for combining annotations. This can combine zero or more
+ * {@linkplain QualifierType qualifier types} and an optional {@linkplain ScopeType scope type}.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+@Documented
+public @interface Stereotype {
+}