You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2009/11/03 00:28:13 UTC
svn commit: r832190 -
/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/
Author: henrib
Date: Mon Nov 2 23:28:13 2009
New Revision: 832190
URL: http://svn.apache.org/viewvc?rev=832190&view=rev
Log:
Javadoc fixes
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/AbstractExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/BooleanGetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckGetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckSetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListGetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListSetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapGetExecutor.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapSetExecutor.java
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/AbstractExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/AbstractExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/AbstractExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/AbstractExecutor.java Mon Nov 2 23:28:13 2009
@@ -81,8 +81,8 @@
/** {@inheritDoc} */
@Override
- public boolean equals(Object arg) {
- return this == arg || (arg instanceof AbstractExecutor && equals((AbstractExecutor) arg));
+ public boolean equals(Object obj) {
+ return this == obj || (obj instanceof AbstractExecutor && equals((AbstractExecutor) obj));
}
/** {@inheritDoc} */
@@ -185,19 +185,19 @@
}
/** {@inheritDoc} */
- public final Object invoke(Object o) throws Exception {
- return execute(o);
+ public final Object invoke(Object obj) throws Exception {
+ return execute(obj);
}
/**
* Gets the property value from an object.
*
- * @param o The object to get the property from.
+ * @param obj The object to get the property from.
* @return The property value.
* @throws IllegalAccessException Method is inaccessible.
* @throws InvocationTargetException Method body throws an exception.
*/
- public abstract Object execute(Object o)
+ public abstract Object execute(Object obj)
throws IllegalAccessException, InvocationTargetException;
/**
@@ -209,11 +209,11 @@
* <code>property</code> must be of the same class as this
* executor's target property (for list and map based executors) and have the same
* value (for other types).</p>
- * @param o The object to get the property from.
- * @param property The property to get from the object.
+ * @param obj The object to get the property from.
+ * @param key The property to get from the object.
* @return The property value or TRY_FAILED if checking failed.
*/
- public Object tryExecute(Object o, Object property) {
+ public Object tryExecute(Object obj, Object key) {
return TRY_FAILED;
}
}
@@ -232,20 +232,20 @@
}
/** {@inheritDoc} */
- public Object invoke(Object o, Object arg) throws Exception {
- return execute(o, arg);
+ public Object invoke(Object obj, Object arg) throws Exception {
+ return execute(obj, arg);
}
/**
* Sets the property value of an object.
*
- * @param o The object to set the property in.
- * @param arg The value.
+ * @param obj The object to set the property in.
+ * @param value The value.
* @return The return value.
* @throws IllegalAccessException Method is inaccessible.
* @throws InvocationTargetException Method body throws an exception.
*/
- public abstract Object execute(Object o, Object arg)
+ public abstract Object execute(Object obj, Object value)
throws IllegalAccessException, InvocationTargetException;
/**
@@ -259,12 +259,12 @@
* value (for other types)
* and that <code>arg</code> must be a valid argument for this
* executor underlying method.</p>
- * @param o The object to invoke the method from.
- * @param property The property to set in the object.
- * @param arg The value to use as the property value.
+ * @param obj The object to invoke the method from.
+ * @param key The property to set in the object.
+ * @param value The value to use as the property value.
* @return The return value or TRY_FAILED if checking failed.
*/
- public Object tryExecute(Object o, Object property, Object arg) {
+ public Object tryExecute(Object obj, Object key, Object value) {
return TRY_FAILED;
}
@@ -306,8 +306,8 @@
}
/** {@inheritDoc} */
- public final Object invoke(Object o, Object[] args) throws Exception {
- return execute(o, args);
+ public final Object invoke(Object obj, Object[] args) throws Exception {
+ return execute(obj, args);
}
/** {@inheritDoc} */
@@ -327,24 +327,24 @@
/**
* Invokes the method to be executed.
*
- * @param o the object to invoke the method upon
+ * @param obj the object to invoke the method upon
* @param args the method arguments
* @return the result of the method invocation
* @throws IllegalAccessException Method is inaccessible.
* @throws InvocationTargetException Method body throws an exception.
*/
- public abstract Object execute(Object o, Object[] args)
+ public abstract Object execute(Object obj, Object[] args)
throws IllegalAccessException, InvocationTargetException;
/**
* Tries to reuse this executor, checking that it is compatible with
* the actual set of arguments.
- * @param o the object to invoke the method upon
+ * @param obj the object to invoke the method upon
* @param name the method name
* @param args the method arguments
* @return the result of the method invocation or INVOKE_FAILED if checking failed.
*/
- public Object tryExecute(String name, Object o, Object[] args){
+ public Object tryExecute(String name, Object obj, Object[] args){
return TRY_FAILED;
}
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/BooleanGetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/BooleanGetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/BooleanGetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/BooleanGetExecutor.java Mon Nov 2 23:28:13 2009
@@ -28,11 +28,11 @@
* Creates an instance by attempting discovery of the get method.
* @param is the introspector
* @param clazz the class to introspect
- * @param identifier the property to get
+ * @param key the property to get
*/
- public BooleanGetExecutor(Introspector is, Class<?> clazz, String identifier) {
- super(clazz, discover(is, clazz, identifier));
- property = identifier;
+ public BooleanGetExecutor(Introspector is, Class<?> clazz, String key) {
+ super(clazz, discover(is, clazz, key));
+ property = key;
}
/** {@inheritDoc} */
@@ -43,20 +43,20 @@
/** {@inheritDoc} */
@Override
- public Object execute(Object o)
+ public Object execute(Object obj)
throws IllegalAccessException, InvocationTargetException {
- return method == null ? null : method.invoke(o, (Object[]) null);
+ return method == null ? null : method.invoke(obj, (Object[]) null);
}
/** {@inheritDoc} */
@Override
- public Object tryExecute(Object o, Object identifier) {
- if (o != null && method != null
+ public Object tryExecute(Object obj, Object key) {
+ if (obj != null && method != null
// ensure method name matches the property name
- && property.equals(identifier)
- && objectClass.equals(o.getClass())) {
+ && property.equals(key)
+ && objectClass.equals(obj.getClass())) {
try {
- return method.invoke(o, (Object[]) null);
+ return method.invoke(obj, (Object[]) null);
} catch (InvocationTargetException xinvoke) {
return TRY_FAILED; // fail
} catch (IllegalAccessException xill) {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckGetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckGetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckGetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckGetExecutor.java Mon Nov 2 23:28:13 2009
@@ -52,28 +52,28 @@
/**
* Get the property from the object.
- * @param o the object.
+ * @param obj the object.
* @return object.get(property)
* @throws IllegalAccessException Method is inaccessible.
* @throws InvocationTargetException Method body throws an exception.
*/
@Override
- public Object execute(Object o)
+ public Object execute(Object obj)
throws IllegalAccessException, InvocationTargetException {
Object[] args = {property};
- return method == null ? null : method.invoke(o, args);
+ return method == null ? null : method.invoke(obj, args);
}
/** {@inheritDoc} */
@Override
- public Object tryExecute(Object o, Object identifier) {
- if (o != null && method != null
+ public Object tryExecute(Object obj, Object key) {
+ if (obj != null && method != null
// ensure method name matches the property name
- && property.equals(identifier)
- && objectClass.equals(o.getClass())) {
+ && property.equals(key)
+ && objectClass.equals(obj.getClass())) {
try {
Object[] args = {property};
- return method.invoke(o, args);
+ return method.invoke(obj, args);
} catch (InvocationTargetException xinvoke) {
return TRY_FAILED; // fail
} catch (IllegalAccessException xill) {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckSetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckSetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckSetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/DuckSetExecutor.java Mon Nov 2 23:28:13 2009
@@ -37,12 +37,12 @@
* Creates an instance.
*@param is the introspector
*@param clazz the class to find the set method from
- *@param identifier the key to use as 1st argument to the set method
- *@param arg the value to use as 2nd argument to the set method
+ *@param key the key to use as 1st argument to the set method
+ *@param value the value to use as 2nd argument to the set method
*/
- public DuckSetExecutor(Introspector is, Class<?> clazz, Object identifier, Object arg) {
- super(clazz, discover(is, clazz, identifier, arg));
- property = identifier;
+ public DuckSetExecutor(Introspector is, Class<?> clazz, Object key, Object value) {
+ super(clazz, discover(is, clazz, key, value));
+ property = key;
}
/** {@inheritDoc} */
@@ -53,26 +53,26 @@
/** {@inheritDoc} */
@Override
- public Object execute(Object o, Object arg)
+ public Object execute(Object obj, Object value)
throws IllegalAccessException, InvocationTargetException {
- Object[] pargs = {property, arg};
+ Object[] pargs = {property, value};
if (method != null) {
- method.invoke(o, pargs);
+ method.invoke(obj, pargs);
}
- return arg;
+ return value;
}
/** {@inheritDoc} */
@Override
- public Object tryExecute(Object o, Object identifier, Object arg) {
- if (o != null && method != null
+ public Object tryExecute(Object obj, Object key, Object value) {
+ if (obj != null && method != null
// ensure method name matches the property name
- && property.equals(identifier)
- && objectClass.equals(o.getClass())) {
+ && property.equals(key)
+ && objectClass.equals(obj.getClass())) {
try {
- Object[] args = {property, arg};
- method.invoke(o, args);
- return arg;
+ Object[] args = {property, value};
+ method.invoke(obj, args);
+ return value;
} catch (InvocationTargetException xinvoke) {
return TRY_FAILED; // fail
} catch (IllegalAccessException xill) {
@@ -86,12 +86,12 @@
* Discovers the method for a {@link DuckSet}.
*@param is the introspector
*@param clazz the class to find the set method from
- *@param identifier the key to use as 1st argument to the set method
- *@param arg the value to use as 2nd argument to the set method
+ *@param key the key to use as 1st argument to the set method
+ *@param value the value to use as 2nd argument to the set method
*@return the method if found, null otherwise
*/
private static java.lang.reflect.Method discover(Introspector is,
- Class<?> clazz, Object identifier, Object arg) {
- return is.getMethod(clazz, "set", makeArgs(identifier, arg));
+ Class<?> clazz, Object key, Object value) {
+ return is.getMethod(clazz, "set", makeArgs(key, value));
}
}
\ No newline at end of file
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListGetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListGetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListGetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListGetExecutor.java Mon Nov 2 23:28:13 2009
@@ -26,7 +26,7 @@
/** The java.lang.reflect.Array.get method used as an active marker in ListGet. */
private static final java.lang.reflect.Method ARRAY_GET =
initMarker(Array.class, "get", Object.class, Integer.TYPE);
- /** The java.util.list.get method used as an active marker in ListGet. */
+ /** The java.util.obj.get method used as an active marker in ListGet. */
private static final java.lang.reflect.Method LIST_GET =
initMarker(List.class, "get", Integer.TYPE);
/** The property. */
@@ -36,11 +36,11 @@
* Creates an instance checking for the List interface or Array capability.
* @param is the introspector
* @param clazz the class to introspect
- * @param index the index to use in list.get(index)
+ * @param key the key to use in obj.get(key)
*/
- public ListGetExecutor(Introspector is, Class<?> clazz, Integer index) {
+ public ListGetExecutor(Introspector is, Class<?> clazz, Integer key) {
super(clazz, discover(clazz));
- property = index;
+ property = key;
}
/** {@inheritDoc} */
@@ -50,29 +50,29 @@
}
/**
- * Get the property from the list or array.
- * @param list the List/array.
- * @return list.get(index)
+ * Get the property from the obj or array.
+ * @param obj the List/array.
+ * @return obj.get(key)
*/
@Override
- public Object execute(final Object list) {
+ public Object execute(final Object obj) {
if (method == ARRAY_GET) {
- return java.lang.reflect.Array.get(list, property.intValue());
+ return java.lang.reflect.Array.get(obj, property.intValue());
} else {
- return ((List<?>) list).get(property.intValue());
+ return ((List<?>) obj).get(property.intValue());
}
}
/** {@inheritDoc} */
@Override
- public Object tryExecute(final Object list, Object index) {
- if (list != null && method != null
- && objectClass.equals(list.getClass())
- && index instanceof Integer) {
+ public Object tryExecute(final Object obj, Object key) {
+ if (obj != null && method != null
+ && objectClass.equals(obj.getClass())
+ && key instanceof Integer) {
if (method == ARRAY_GET) {
- return java.lang.reflect.Array.get(list, (Integer) index);
+ return java.lang.reflect.Array.get(obj, (Integer) key);
} else {
- return ((List<?>) list).get((Integer) index);
+ return ((List<?>) obj).get((Integer) key);
}
}
return TRY_FAILED;
@@ -80,9 +80,9 @@
/**
- * Finds the method to perform the get on a list of array.
+ * Finds the method to perform the get on a obj of array.
* @param clazz the class to introspect
- * @return a marker method, list.get or array.get
+ * @return a marker method, obj.get or array.get
*/
static java.lang.reflect.Method discover(Class<?> clazz) {
//return discoverList(false, clazz, property);
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListSetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListSetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListSetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/ListSetExecutor.java Mon Nov 2 23:28:13 2009
@@ -26,7 +26,7 @@
/** The java.lang.reflect.Array.get method used as an active marker in ListGet. */
private static final java.lang.reflect.Method ARRAY_SET =
initMarker(Array.class, "set", Object.class, Integer.TYPE, Object.class);
- /** The java.util.list.set method used as an active marker in ListSet. */
+ /** The java.util.obj.set method used as an active marker in ListSet. */
private static final java.lang.reflect.Method LIST_SET =
initMarker(List.class, "set", Integer.TYPE, Object.class);
/** The property. */
@@ -36,12 +36,12 @@
* Creates an instance checking for the List interface or Array capability.
* @param is the introspector
* @param clazz the class that might implement the map interface
- * @param index the index to use in list.set(index,value)
- * @param value the value to use in list.set(index,value)
+ * @param key the key to use in obj.set(key,value)
+ * @param value the value to use in obj.set(key,value)
*/
- public ListSetExecutor(Introspector is, Class<?> clazz, Integer index, Object value) {
+ public ListSetExecutor(Introspector is, Class<?> clazz, Integer key, Object value) {
super(clazz, discover(clazz));
- property = index;
+ property = key;
}
/** {@inheritDoc} */
@@ -51,48 +51,48 @@
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override
- public Object execute(final Object list, Object arg) {
+ public Object execute(final Object obj, Object value) {
if (method == ARRAY_SET) {
- java.lang.reflect.Array.set(list, property.intValue(), arg);
+ java.lang.reflect.Array.set(obj, property.intValue(), value);
} else {
- @SuppressWarnings("unchecked")
- final List<Object> asList = (List<Object>) list;
- asList.set(property.intValue(), arg);
+ final List<Object> list = (List<Object>) obj;
+ list.set(property.intValue(), value);
}
- return arg;
+ return value;
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override
- public Object tryExecute(final Object list, Object index, Object arg) {
- if (list != null && method != null
- && objectClass.equals(list.getClass())
- && index instanceof Integer) {
+ public Object tryExecute(final Object obj, Object key, Object value) {
+ if (obj != null && method != null
+ && objectClass.equals(obj.getClass())
+ && key instanceof Integer) {
if (method == ARRAY_SET) {
- Array.set(list, (Integer) index, arg);
+ Array.set(obj, (Integer) key, value);
} else {
- @SuppressWarnings("unchecked")
- final List<Object> asList = (List<Object>) list;
- asList.set((Integer) index, arg);
+ final List<Object> list = (List<Object>) obj;
+ list.set((Integer) key, value);
}
- return arg;
+ return value;
}
return TRY_FAILED;
}
/**
- * Finds the method to perform 'set' on a list of array.
+ * Finds the method to perform 'set' on a obj of array.
* @param clazz the class to introspect
- * @return a marker method, list.set or array.set
+ * @return a marker method, obj.set or array.set
*/
static java.lang.reflect.Method discover(Class<?> clazz) {
if (clazz.isArray()) {
// we could verify if the call can be performed but it does not change
// the fact we would fail...
// Class<?> formal = clazz.getComponentType();
- // Class<?> actual = arg == null? Object.class : arg.getClass();
+ // Class<?> actual = value == null? Object.class : value.getClass();
// if (IntrospectionUtils.isMethodInvocationConvertible(formal, actual, false)) {
return ARRAY_SET;
// }
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapGetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapGetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapGetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapGetExecutor.java Mon Nov 2 23:28:13 2009
@@ -49,23 +49,25 @@
/**
* Get the property from the map.
- * @param map the map.
+ * @param obj the map.
* @return map.get(property)
*/
@SuppressWarnings("unchecked")
@Override
- public Object execute(final Object map) {
- return ((Map<Object, ?>) map).get(property);
+ public Object execute(final Object obj) {
+ final Map<Object,?> map = (Map<Object, ?>) obj;
+ return map.get(property);
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
- public Object tryExecute(final Object map, Object key) {
- if (map != null && method != null
- && objectClass.equals(map.getClass())
+ public Object tryExecute(final Object obj, Object key) {
+ if (obj != null && method != null
+ && objectClass.equals(obj.getClass())
&& (key == null || property.getClass().equals(key.getClass()))) {
- return ((Map<Object, ?>) map).get(key);
+ final Map<Object,?> map = (Map<Object, ?>) obj;
+ return map.get(key);
}
return TRY_FAILED;
}
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapSetExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapSetExecutor.java?rev=832190&r1=832189&r2=832190&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapSetExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/MapSetExecutor.java Mon Nov 2 23:28:13 2009
@@ -49,20 +49,22 @@
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
- public Object execute(final Object map, Object value)
+ public Object execute(final Object obj, Object value)
throws IllegalAccessException, InvocationTargetException {
- ((Map<Object, Object>) map).put(property, value);
+ final Map<Object,Object> map = ((Map<Object, Object>) obj);
+ map.put(property, value);
return value;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
- public Object tryExecute(final Object map, Object key, Object value) {
- if (map != null && method != null
- && objectClass.equals(map.getClass())
+ public Object tryExecute(final Object obj, Object key, Object value) {
+ if (obj != null && method != null
+ && objectClass.equals(obj.getClass())
&& (key == null || property.getClass().equals(key.getClass()))) {
- ((Map<Object, Object>) map).put(key, value);
+ final Map<Object,Object> map = ((Map<Object, Object>) obj);
+ map.put(key, value);
return value;
}
return TRY_FAILED;