Author: ggregory
Date: Sat May 31 00:48:36 2014
New Revision: 1598793
URL: http://svn.apache.org/r1598793
Log:
PluginAttribute: Add support for class Class and types byte, char, and short.
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginAttribute.java
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginAttributeVisitor.java
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginAttribute.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginAttribute.java?rev=1598793&r1=1598792&r2=1598793&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginAttribute.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginAttribute.java
Sat May 31 00:48:36 2014
@@ -44,6 +44,16 @@ public @interface PluginAttribute {
boolean defaultBoolean() default false;
/**
+ * Specifies the default byte value to use.
+ */
+ byte defaultByte() default 0;
+
+ /**
+ * Specifies the default byte value to use.
+ */
+ char defaultChar() default 0;
+
+ /**
* Specifies the default {@link Class} value to use.
*/
Class<?> defaultClass() default Object.class;
@@ -69,6 +79,11 @@ public @interface PluginAttribute {
long defaultLong() default 0L;
/**
+ * Specifies the default long value to use.
+ */
+ short defaultShort() default 0;
+
+ /**
* Specifies the default value this attribute should use if none is
provided or if the provided value is invalid.
*/
String defaultString() default Strings.EMPTY;
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginAttributeVisitor.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginAttributeVisitor.java?rev=1598793&r1=1598792&r2=1598793&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginAttributeVisitor.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginAttributeVisitor.java
Sat May 31 00:48:36 2014
@@ -60,6 +60,18 @@ public class PluginAttributeVisitor exte
if (this.conversionType == double.class || this.conversionType ==
Double.class) {
return this.annotation.defaultDouble();
}
+ if (this.conversionType == byte.class || this.conversionType ==
Byte.class) {
+ return this.annotation.defaultByte();
+ }
+ if (this.conversionType == char.class || this.conversionType ==
Character.class) {
+ return this.annotation.defaultChar();
+ }
+ if (this.conversionType == short.class || this.conversionType ==
Short.class) {
+ return this.annotation.defaultShort();
+ }
+ if (this.conversionType == Class.class) {
+ return this.annotation.defaultClass();
+ }
return this.substitutor.replace(event,
this.annotation.defaultString());
}
}