Minor Polishing.

This commit is contained in:
Erwin Vervaet
2007-03-30 09:51:30 +00:00
parent 1e589a61fc
commit c2150e9b60
2 changed files with 26 additions and 27 deletions

View File

@@ -28,6 +28,7 @@ import org.springframework.util.StringUtils;
* Abstract base class for expression parsers.
*
* @author Keith Donald
* @author Erwin Vervaet
*/
public abstract class AbstractExpressionParser implements ExpressionParser {

View File

@@ -197,14 +197,37 @@ public class MethodKey implements Serializable {
return hash;
}
public String toString() {
return methodName + "(" + parameterTypesString() + ")";
}
/**
* Convenience method that returns the parameter types describing the
* signature of the method as a string.
*/
private String parameterTypesString() {
StringBuffer parameterTypesString = new StringBuffer();
for (int i = 0; i < parameterTypes.length; i++) {
if (parameterTypes[i] == null) {
parameterTypesString.append("<any>");
}
else {
parameterTypesString.append(ClassUtils.getShortName(parameterTypes[i]));
}
if (i < parameterTypes.length - 1) {
parameterTypesString.append(',');
}
}
return parameterTypesString.toString();
}
// internal helpers
/**
* Determine if the given target type is assignable from the given value
* type, assuming setting by reflection. Considers primitive wrapper classes
* as assignable to the corresponding primitive types. <p> NOTE: Pulled from
* ClassUtils in Spring 2.0 for 1.2.8 compatability. Should be collapsed
* when 1.2.9 is released.
* ClassUtils in Spring 2.0 for 1.2.8 compatability.
* @param targetType the target type
* @param valueType the value type that should be assigned to the target
* type
@@ -230,29 +253,4 @@ public class MethodKey implements Serializable {
primitiveWrapperTypeMap.put(Long.class, long.class);
primitiveWrapperTypeMap.put(Short.class, short.class);
}
public String toString() {
return methodName + "(" + parameterTypesString() + ")";
}
/**
* Convenience method that returns the parameter types describing the
* signature of the method as a string.
*/
private String parameterTypesString() {
StringBuffer parameterTypesString = new StringBuffer();
for (int i = 0; i < parameterTypes.length; i++) {
if (parameterTypes[i] == null) {
parameterTypesString.append("<any>");
}
else {
parameterTypesString.append(ClassUtils.getShortName(parameterTypes[i]));
}
if (i < parameterTypes.length - 1) {
parameterTypesString.append(',');
}
}
return parameterTypesString.toString();
}
}