File tree Expand file tree Collapse file tree 7 files changed +36
-3
lines changed
main/java/org/apache/logging/log4j/docgen/processor
test/resources/DescriptorGeneratorTest Expand file tree Collapse file tree 7 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,10 @@ final class Annotations {
5353 private static final Collection <String > PLUGIN_ATTRIBUTE_ANNOTATION_NAMES = Arrays .asList (
5454 "org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute" ,
5555 "org.apache.logging.log4j.core.config.plugins.PluginAttribute" ,
56+ "org.apache.logging.log4j.core.config.plugins.PluginValue" ,
5657 "org.apache.logging.log4j.plugins.PluginAttribute" ,
57- "org.apache.logging.log4j.plugins.PluginBuilderAttribute" );
58+ "org.apache.logging.log4j.plugins.PluginBuilderAttribute" ,
59+ "org.apache.logging.log4j.plugins.PluginValue" );
5860 private static final Collection <String > PLUGIN_ELEMENT_ANNOTATION_NAMES = Arrays .asList (
5961 "org.apache.logging.log4j.core.config.plugins.PluginElement" ,
6062 "org.apache.logging.log4j.plugins.PluginElement" );
Original file line number Diff line number Diff line change 8686 <description >A `String` attribute.</description >
8787 </attribute >
8888 <attribute name =" undocumentedAttribute" type =" double" />
89+ <attribute name =" valueAttribute" type =" int" >
90+ <description >An attribute that can be also be inserted as content of the XML element.</description >
91+ </attribute >
8992 </attributes >
9093 <elements >
9194 <element type =" example.AbstractAppender" >
@@ -154,6 +157,9 @@ It also implements:
154157 <attribute name =" doubleAttr" type =" double" >
155158 <description >A `double` attribute.</description >
156159 </attribute >
160+ <attribute name =" elementValue" type =" int" >
161+ <description >An attribute that can be also be inserted as content of the XML element.</description >
162+ </attribute >
157163 <attribute name =" enumAttr" type =" example.MyEnum" >
158164 <description >An `enum` attribute.</description >
159165 </attribute >
Original file line number Diff line number Diff line change 2626import org .apache .logging .log4j .core .config .plugins .PluginElement ;
2727import org .apache .logging .log4j .core .config .plugins .PluginFactory ;
2828import org .apache .logging .log4j .core .config .plugins .validation .constraints .Required ;
29+ import org .apache .logging .log4j .plugins .PluginValue ;
2930
3031/**
3132 * Example plugin
@@ -115,6 +116,11 @@ public static final class Builder extends ParentBuilder
115116
116117 private @ PluginBuilderAttribute double undocumentedAttribute ;
117118
119+ /**
120+ * An attribute that can be also be inserted as content of the XML element.
121+ */
122+ private @ PluginValue int valueAttribute ;
123+
118124 private Object notAnAttribute ;
119125
120126 /**
Original file line number Diff line number Diff line change 2121import org .apache .logging .log4j .core .config .plugins .PluginElement ;
2222import org .apache .logging .log4j .core .config .plugins .PluginFactory ;
2323import org .apache .logging .log4j .core .config .plugins .validation .constraints .Required ;
24+ import org .apache .logging .log4j .plugins .PluginValue ;
2425
2526/**
2627 * Example plugin without a builder.
@@ -42,6 +43,7 @@ public final class MyOldLayout implements Layout {
4243 * @param enumAttr An {@code enum} attribute.
4344 * @param nestedLayout An element with multiplicity {@code 1}.
4445 * @param filters An element with multiplicity {@code n}.
46+ * @param valueAttribute An attribute that can be also be inserted as content of the XML element.
4547 */
4648 @ PluginFactory
4749 public static MyOldLayout newLayout (
@@ -57,7 +59,8 @@ public static MyOldLayout newLayout(
5759 final @ PluginAttribute ("otherName" ) String origName ,
5860 final @ PluginAttribute ("enumAttr" ) MyEnum enumAttr ,
5961 final @ PluginElement ("nestedLayout" ) Layout nestedLayout ,
60- final @ PluginElement ("filters" ) Filter [] filters ) {
62+ final @ PluginElement ("filters" ) Filter [] filters ,
63+ final @ PluginValue ("elementValue" ) int valueAttribute ) {
6164 return null ;
6265 }
6366}
Original file line number Diff line number Diff line change 2727import org .apache .logging .log4j .plugins .PluginBuilderAttribute ;
2828import org .apache .logging .log4j .plugins .PluginElement ;
2929import org .apache .logging .log4j .plugins .PluginFactory ;
30+ import org .apache .logging .log4j .plugins .PluginValue ;
3031import org .apache .logging .log4j .plugins .validation .constraints .Required ;
3132
3233/**
@@ -118,6 +119,11 @@ public static final class Builder extends ParentBuilder
118119
119120 private @ PluginBuilderAttribute double undocumentedAttribute ;
120121
122+ /**
123+ * An attribute that can be also be inserted as content of the XML element.
124+ */
125+ private @ PluginValue int valueAttribute ;
126+
121127 private Object notAnAttribute ;
122128
123129 /**
Original file line number Diff line number Diff line change 2020import org .apache .logging .log4j .plugins .Plugin ;
2121import org .apache .logging .log4j .plugins .PluginAttribute ;
2222import org .apache .logging .log4j .plugins .PluginElement ;
23+ import org .apache .logging .log4j .plugins .PluginValue ;
2324import org .apache .logging .log4j .plugins .validation .constraints .Required ;
2425
2526/**
@@ -42,6 +43,7 @@ public final class MyOldLayout implements Layout {
4243 * @param enumAttr An {@code enum} attribute.
4344 * @param nestedLayout An element with multiplicity {@code 1}.
4445 * @param filters An element with multiplicity {@code n}.
46+ * @param valueAttribute An attribute that can be also be inserted as content of the XML element.
4547 */
4648 @ Factory
4749 public static MyOldLayout newLayout (
@@ -57,7 +59,8 @@ public static MyOldLayout newLayout(
5759 final @ PluginAttribute ("otherName" ) String origName ,
5860 final @ PluginAttribute MyEnum enumAttr ,
5961 final @ PluginElement Layout nestedLayout ,
60- final @ PluginElement Filter [] filters ) {
62+ final @ PluginElement Filter [] filters ,
63+ final @ PluginValue ("elementValue" ) int valueAttribute ) {
6164 return null ;
6265 }
6366}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <entry xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xmlns =" https://logging.apache.org/xml/ns"
4+ xsi : schemaLocation =" https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
5+ type =" added" >
6+ <description format =" asciidoc" >Add support for the `@PluginValue` annotation.</description >
7+ </entry >
You can’t perform that action at this time.
0 commit comments