Author: mattsicker
Date: Mon May 26 22:01:54 2014
New Revision: 1597651

URL: http://svn.apache.org/r1597651
Log:
Specify default values in builder class.

  - This is more of a temporary measure until I can think up 
  something more elegant (most likely involving a separate 
  @PluginBuilderAttribute annotation or something).

Modified:
    
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java

Modified: 
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1597651&r1=1597650&r2=1597651&view=diff
==============================================================================
--- 
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
 (original)
+++ 
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
 Mon May 26 22:01:54 2014
@@ -304,7 +304,10 @@ public final class PatternLayout extends
      */
     public static class Builder implements 
org.apache.logging.log4j.core.util.Builder<PatternLayout> {
 
-        @PluginAttribute("pattern")
+        // FIXME: it seems rather redundant to repeat default values (same 
goes for field names)
+        // perhaps introduce a @PluginBuilderAttribute that has no values of 
its own and uses reflection?
+
+        @PluginAttribute(value = "pattern", defaultStringValue = 
PatternLayout.DEFAULT_CONVERSION_PATTERN)
         private String pattern = PatternLayout.DEFAULT_CONVERSION_PATTERN;
 
         @PluginConfiguration
@@ -313,13 +316,13 @@ public final class PatternLayout extends
         @PluginElement("Replace")
         private RegexReplacement regexReplacement = null;
 
-        @PluginAttribute("charset")
+        @PluginAttribute(value = "charset", defaultStringValue = "UTF-8")
         private Charset charset = Charsets.UTF_8;
 
-        @PluginAttribute("alwaysWriteExceptions")
+        @PluginAttribute(value = "alwaysWriteExceptions", defaultBooleanValue 
= true)
         private boolean alwaysWriteExceptions = true;
 
-        @PluginAttribute("noConsoleNoAnsi")
+        @PluginAttribute(value = "noConsoleNoAnsi", defaultBooleanValue = 
false)
         private boolean noConsoleNoAnsi = false;
 
         @PluginAttribute("header")


Reply via email to