[jboss-cvs] JBoss Messaging SVN: r7645 - trunk/src/main/org/jboss/messaging/utils.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 30 10:22:22 EDT 2009


Author: jmesnil
Date: 2009-07-30 10:22:22 -0400 (Thu, 30 Jul 2009)
New Revision: 7645

Modified:
   trunk/src/main/org/jboss/messaging/utils/TypedProperties.java
Log:
* added toString() to TypedProperties
* changed PropertyValue type to an abstract class to provide a default toString() implementation
  which prints out the value of the property

Modified: trunk/src/main/org/jboss/messaging/utils/TypedProperties.java
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/TypedProperties.java	2009-07-30 09:54:57 UTC (rev 7644)
+++ trunk/src/main/org/jboss/messaging/utils/TypedProperties.java	2009-07-30 14:22:22 UTC (rev 7645)
@@ -337,6 +337,12 @@
       }
    }
    
+   @Override
+   public String toString()
+   {
+      return "TypedProperties[" + properties  + "]";
+   }
+   
    // Private ------------------------------------------------------------------------------------
 
    private void checkCreateProperties()
@@ -402,16 +408,22 @@
 
    // Inner classes ------------------------------------------------------------------------------
 
-   private interface PropertyValue
+   private static abstract class PropertyValue
    {
-      Object getValue();
+      abstract Object getValue();
 
-      void write(MessagingBuffer buffer);
+      abstract void write(MessagingBuffer buffer);
 
-      int encodeSize();
+      abstract int encodeSize();
+      
+      @Override
+      public String toString()
+      {
+         return "" + getValue();
+      }
    }
 
-   private static final class NullValue implements PropertyValue
+   private static final class NullValue extends PropertyValue
    {
       public NullValue()
       {
@@ -434,7 +446,7 @@
 
    }
 
-   private static final class BooleanValue implements PropertyValue
+   private static final class BooleanValue extends PropertyValue
    {
       final boolean val;
 
@@ -466,7 +478,7 @@
 
    }
 
-   private static final class ByteValue implements PropertyValue
+   private static final class ByteValue extends PropertyValue
    {
       final byte val;
 
@@ -497,7 +509,7 @@
       }
    }
 
-   private static final class BytesValue implements PropertyValue
+   private static final class BytesValue extends PropertyValue
    {
       final byte[] val;
 
@@ -532,7 +544,7 @@
 
    }
 
-   private static final class ShortValue implements PropertyValue
+   private static final class ShortValue extends PropertyValue
    {
       final short val;
 
@@ -563,7 +575,7 @@
       }
    }
 
-   private static final class IntValue implements PropertyValue
+   private static final class IntValue extends PropertyValue
    {
       final int val;
 
@@ -594,7 +606,7 @@
       }
    }
 
-   private static final class LongValue implements PropertyValue
+   private static final class LongValue extends PropertyValue
    {
       final long val;
 
@@ -625,7 +637,7 @@
       }
    }
 
-   private static final class FloatValue implements PropertyValue
+   private static final class FloatValue extends PropertyValue
    {
       final float val;
 
@@ -657,7 +669,7 @@
 
    }
 
-   private static final class DoubleValue implements PropertyValue
+   private static final class DoubleValue extends PropertyValue
    {
       final double val;
 
@@ -688,7 +700,7 @@
       }
    }
 
-   private static final class CharValue implements PropertyValue
+   private static final class CharValue extends PropertyValue
    {
       final char val;
 
@@ -719,7 +731,7 @@
       }
    }
 
-   private static final class StringValue implements PropertyValue
+   private static final class StringValue extends PropertyValue
    {
       final SimpleString val;
 
@@ -748,11 +760,5 @@
       {
          return SIZE_BYTE + SimpleString.sizeofString(val);
       }
-
-      @Override
-      public String toString()
-      {
-         return val.toString();
-      }
    }
 }




More information about the jboss-cvs-commits mailing list