if (beanInfo.checkVariable(name)) {
// Bean is defined using useBean, introspect at compile time
Class<?> bean = beanInfo.getBeanType(name);
- String beanName = JspUtil.getCanonicalName(bean);
+ String beanName = bean.getCanonicalName();
java.lang.reflect.Method meth = JspRuntimeLibrary
.getReadMethod(bean, property);
String methodName = meth.getName();
Class<?> bean = ctxt.getClassLoader().loadClass(klass);
if (klass.indexOf('$') >= 0) {
// Obtain the canonical type name
- canonicalName = JspUtil.getCanonicalName(bean);
+ canonicalName = bean.getCanonicalName();
} else {
canonicalName = klass;
}
declareScriptingVars(n, VariableInfo.AT_BEGIN);
saveScriptingVars(n, VariableInfo.AT_BEGIN);
- String tagHandlerClassName = JspUtil
- .getCanonicalName(tagHandlerClass);
+ String tagHandlerClassName = tagHandlerClass.getCanonicalName();
if (isPoolingEnabled && !(n.implementsJspIdConsumer())) {
out.printin(tagHandlerClassName);
out.print(" ");
declareScriptingVars(n, VariableInfo.AT_BEGIN);
saveScriptingVars(n, VariableInfo.AT_BEGIN);
- String tagHandlerClassName = JspUtil
- .getCanonicalName(tagHandlerClass);
+ String tagHandlerClassName = tagHandlerClass.getCanonicalName();
writeNewInstance(tagHandlerVar, tagHandlerClassName);
generateSetters(n, tagHandlerVar, handlerInfo, true);
}
if (propEditorClass != null) {
- String className = JspUtil.getCanonicalName(c);
+ String className = c.getCanonicalName();
return "("
+ className
+ ")org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromBeanInfoPropertyEditor("
+ className + ".class, \"" + attrName + "\", " + quoted
- + ", " + JspUtil.getCanonicalName(propEditorClass)
- + ".class)";
+ + ", " + propEditorClass.getCanonicalName() + ".class)";
} else if (c == String.class) {
return quoted;
} else if (c == boolean.class) {
} else if (c == Object.class) {
return "new String(" + quoted + ")";
} else {
- String className = JspUtil.getCanonicalName(c);
+ String className = c.getCanonicalName();
return "("
+ className
+ ")org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager("
* Determine whether to use the expected type's textual name or, if it's
* a primitive, the name of its correspondent boxed type.
*/
- String targetType = getCanonicalName(expectedType);
+ String targetType = expectedType.getCanonicalName();
String primitiveConverterMethod = null;
if (expectedType.isPrimitive()) {
if (expectedType.equals(Boolean.TYPE)) {
}
return resultType.toString();
}
-
- /**
- * Compute the canonical name from a Class instance. Note that a simple
- * replacement of '$' with '.' of a binary name would not work, as '$' is a
- * legal Java Identifier character.
- *
- * @param c
- * A instance of java.lang.Class
- * @return The canonical name of c.
- */
- public static String getCanonicalName(Class<?> c) {
-
- String binaryName = c.getName();
- c = c.getDeclaringClass();
-
- if (c == null) {
- return binaryName;
- }
-
- StringBuilder buf = new StringBuilder(binaryName);
- do {
- buf.setCharAt(c.getName().length(), '.');
- c = c.getDeclaringClass();
- } while (c != null);
-
- return buf.toString();
- }
}