You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2006/05/01 04:06:06 UTC

svn commit: r398502 - /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java

Author: dion
Date: Sun Apr 30 19:06:05 2006
New Revision: 398502

URL: http://svn.apache.org/viewcvs?rev=398502&view=rev
Log:
Checkstyle

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java?rev=398502&r1=398501&r2=398502&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java Sun Apr 30 19:06:05 2006
@@ -41,6 +41,9 @@
  * @version $Id$
  */
 public class UberspectImpl implements Uberspect, UberspectLoggable {
+    /** index of the first character of the property. */
+    private static final int PROPERTY_START_INDEX = 3;
+
     /**
      * Our runtime logger.
      */
@@ -55,6 +58,7 @@
      * init - does nothing - we need to have setRuntimeLogger called before
      * getting our introspector, as the default vel introspector depends upon
      * it.
+     * @throws Exception on any error.
      */
     public void init() throws Exception {
     }
@@ -62,6 +66,7 @@
     /**
      * Sets the runtime logger - this must be called before anything else
      * besides init() as to get the logger. Makes the pull model appealing...
+     * @param runtimeLogger service to use for logging.
      */
     public void setRuntimeLogger(Log runtimeLogger) {
         rlog = runtimeLogger;
@@ -69,7 +74,7 @@
     }
 
     /**
-     * To support iteratives - #foreach().
+     * {@inheritDoc}
      */
     public Iterator getIterator(Object obj, Info i) throws Exception {
         if (obj.getClass().isArray()) {
@@ -100,11 +105,12 @@
     }
 
     /**
-     * Method.
+     * {@inheritDoc}
      */
     public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception {
-        if (obj == null)
+        if (obj == null) {
             return null;
+        }
 
         Method m = introspector.getMethod(obj.getClass(), methodName, args);
         if (m == null && obj instanceof Class) {
@@ -115,7 +121,7 @@
     }
 
     /**
-     * Property getter.
+     * {@inheritDoc}
      */
     public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i) throws Exception {
         AbstractExecutor executor;
@@ -148,7 +154,7 @@
     }
 
     /**
-     * Property setter
+     * {@inheritDoc}
      */
     public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info i) throws Exception {
         Class claz = obj.getClass();
@@ -171,10 +177,10 @@
                 StringBuffer sb = new StringBuffer("set");
                 sb.append(identifier);
 
-                if (Character.isLowerCase(sb.charAt(3))) {
-                    sb.setCharAt(3, Character.toUpperCase(sb.charAt(3)));
+                if (Character.isLowerCase(sb.charAt(PROPERTY_START_INDEX))) {
+                    sb.setCharAt(PROPERTY_START_INDEX, Character.toUpperCase(sb.charAt(PROPERTY_START_INDEX)));
                 } else {
-                    sb.setCharAt(3, Character.toLowerCase(sb.charAt(3)));
+                    sb.setCharAt(PROPERTY_START_INDEX, Character.toLowerCase(sb.charAt(PROPERTY_START_INDEX)));
                 }
 
                 vm = getMethod(obj, sb.toString(), params, i);
@@ -193,8 +199,9 @@
 
                 vm = getMethod(obj, "put", params, i);
 
-                if (vm != null)
+                if (vm != null) {
                     return new VelSetterImpl(vm, identifier);
+                }
             }
         }
 
@@ -202,18 +209,27 @@
     }
 
     /**
-     * Implementation of VelMethod
+     * An implementation of {@link VelMethod}.
      */
     public class VelMethodImpl implements VelMethod {
-        Method method = null;
-
+        /** the method. */
+        protected Method method = null;
+        /** 
+         * Create a new instance.
+         * 
+         * @param m the method.
+         */
         public VelMethodImpl(Method m) {
             method = m;
         }
 
-        private VelMethodImpl() {
-        }
-
+        /**
+         * Invoke the method on the object.
+         * @param o the object
+         * @param params method parameters.
+         * @return the result
+         * @throws Exception on any error.
+         */
         public Object invoke(Object o, Object[] params) throws Exception {
             try {
                 return method.invoke(o, params);



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