myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r935867 - in /myfaces/extensions/cdi/trunk/jse-modules/message-module: api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/ impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/ impl/src/main/java/org/apache/myfaces...
Date Tue, 20 Apr 2010 10:55:00 GMT
Author: gpetracek
Date: Tue Apr 20 10:55:00 2010
New Revision: 935867

URL: http://svn.apache.org/viewvc?rev=935867&view=rev
Log:
EXTCDI-21 minor improvements

Modified:
    myfaces/extensions/cdi/trunk/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/Formatter.java
    myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageBuilder.java
    myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultNamedArgument.java
    myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/DefaultNumberFormatter.java
    myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/ToStringFormatter.java

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/Formatter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/Formatter.java?rev=935867&r1=935866&r2=935867&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/Formatter.java
(original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/Formatter.java
Tue Apr 20 10:55:00 2010
@@ -26,4 +26,7 @@ public interface Formatter<T>
     boolean isResponsibleFor(Class<?> type);
 
     String format(MessageContext messageContext, T valueToFormat);
+
+    //TODO
+    boolean isDefault();
 }

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageBuilder.java?rev=935867&r1=935866&r2=935867&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageBuilder.java
(original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultMessageBuilder.java
Tue Apr 20 10:55:00 2010
@@ -266,7 +266,7 @@ class DefaultMessageBuilder implements M
             argument = arguments[i];
             formatter = this.messageContext.config().getFormatterFactory().findFormatter(argument.getClass());
 
-            if (formatter != null)
+            if (formatter != null && !formatter.isDefault())
             {
                 //noinspection unchecked
                 result.append(formatter.format(this.messageContext, argument));
@@ -277,7 +277,16 @@ class DefaultMessageBuilder implements M
             }
             else
             {
-                result.append(argument.toString());
+                //use default formatter (if available)
+                if(formatter != null)
+                {
+                    //noinspection unchecked
+                    result.append(formatter.format(this.messageContext, argument));
+                }
+                else
+                {
+                    result.append(argument.toString());
+                }
             }
         }
         result.append(')');

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultNamedArgument.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultNamedArgument.java?rev=935867&r1=935866&r2=935867&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultNamedArgument.java
(original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/DefaultNamedArgument.java
Tue Apr 20 10:55:00 2010
@@ -84,4 +84,10 @@ class DefaultNamedArgument implements Na
         result = 31 * result + (value != null ? value.hashCode() : 0);
         return result;
     }
+
+    @Override
+    public String toString()
+    {
+        return "name: " + getName() + " value: " + getValue();
+    }
 }

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/DefaultNumberFormatter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/DefaultNumberFormatter.java?rev=935867&r1=935866&r2=935867&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/DefaultNumberFormatter.java
(original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/DefaultNumberFormatter.java
Tue Apr 20 10:55:00 2010
@@ -74,6 +74,11 @@ class DefaultNumberFormatter implements 
         }
     }
 
+    public boolean isDefault()
+    {
+        return false;
+    }
+
     private void resetConfig()
     {
         this.groupingSeparator = null;

Modified: myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/ToStringFormatter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/ToStringFormatter.java?rev=935867&r1=935866&r2=935867&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/ToStringFormatter.java
(original)
+++ myfaces/extensions/cdi/trunk/jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/formatter/ToStringFormatter.java
Tue Apr 20 10:55:00 2010
@@ -46,4 +46,9 @@ class ToStringFormatter implements Forma
     {
         return valueToFormat != null ? valueToFormat.toString() : "";
     }
+
+    public boolean isDefault()
+    {
+        return true;
+    }
 }



Mime
View raw message