commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r320808 - /jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java
Date Thu, 13 Oct 2005 17:03:33 GMT
Author: jcarman
Date: Thu Oct 13 10:03:31 2005
New Revision: 320808

URL: http://svn.apache.org/viewcvs?rev=320808&view=rev
Log:
Reformatted code and made helper methods private.

Modified:
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java?rev=320808&r1=320807&r2=320808&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/LoggingMethodInterceptor.java
Thu Oct 13 10:03:31 2005
@@ -25,18 +25,32 @@
  * An interceptor which logs each method invocation.
  * <b>Note</b>: The implementation of this class was borrowed from
  * HiveMind's logging interceptor.
+ *
  * @author James Carman
  * @version 1.0
  */
 public class LoggingMethodInterceptor implements MethodInterceptor
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
+    private static final int BUFFER_SIZE = 100;
     private Log log;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public LoggingMethodInterceptor( Log log )
     {
         this.log = log;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// MethodInterceptor Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object invoke( MethodInvocation methodInvocation ) throws Throwable
     {
         if( log.isDebugEnabled() )
@@ -68,9 +82,11 @@
         }
     }
 
-    private static final int BUFFER_SIZE = 100;
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
 
-    public void entry( String methodName, Object[] args )
+    private void entry( String methodName, Object[] args )
     {
         StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
         buffer.append( "BEGIN " );
@@ -90,37 +106,7 @@
         log.debug( buffer.toString() );
     }
 
-    public void exit( String methodName, Object result )
-    {
-        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
-        buffer.append( "END " );
-        buffer.append( methodName );
-        buffer.append( "() [" );
-        convert( buffer, result );
-        buffer.append( "]" );
-        log.debug( buffer.toString() );
-    }
-
-    public void voidExit( String methodName )
-    {
-        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
-        buffer.append( "END " );
-        buffer.append( methodName );
-        buffer.append( "()" );
-        log.debug( buffer.toString() );
-    }
-
-    public void exception( String methodName, Throwable t )
-    {
-        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
-        buffer.append( "EXCEPTION " );
-        buffer.append( methodName );
-        buffer.append( "() -- " );
-        buffer.append( t.getClass().getName() );
-        log.debug( buffer.toString(), t );
-    }
-
-    public void convert( StringBuffer buffer, Object input )
+    private void convert( StringBuffer buffer, Object input )
     {
         if( input == null )
         {
@@ -154,4 +140,35 @@
         }
         buffer.append( "}" );
     }
+
+    private void exception( String methodName, Throwable t )
+    {
+        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
+        buffer.append( "EXCEPTION " );
+        buffer.append( methodName );
+        buffer.append( "() -- " );
+        buffer.append( t.getClass().getName() );
+        log.debug( buffer.toString(), t );
+    }
+
+    private void exit( String methodName, Object result )
+    {
+        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
+        buffer.append( "END " );
+        buffer.append( methodName );
+        buffer.append( "() [" );
+        convert( buffer, result );
+        buffer.append( "]" );
+        log.debug( buffer.toString() );
+    }
+
+    private void voidExit( String methodName )
+    {
+        StringBuffer buffer = new StringBuffer( BUFFER_SIZE );
+        buffer.append( "END " );
+        buffer.append( methodName );
+        buffer.append( "()" );
+        log.debug( buffer.toString() );
+    }
 }
+



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message