Methods Summary |
---|
public static java.lang.Class | forName(java.lang.String name)
if (null == name || "".equals(name)) {
return null;
}
Class c = forNamePrimitive(name);
if (c == null) {
if (name.endsWith("[]")) {
String nc = name.substring(0, name.length() - 2);
c = Class.forName(nc, true, Thread.currentThread().getContextClassLoader());
c = Array.newInstance(c, 0).getClass();
} else {
c = Class.forName(name, true, Thread.currentThread().getContextClassLoader());
}
}
return c;
|
protected static java.lang.Class | forNamePrimitive(java.lang.String name)
if (name.length() <= 8) {
int p = Arrays.binarySearch(PRIMITIVE_NAMES, name);
if (p >= 0) {
return PRIMITIVES[p];
}
}
return null;
|
public static java.lang.reflect.Method | getMethod(java.lang.Object base, java.lang.Object property, java.lang.Class[] paramTypes)Returns a method based on the criteria
if (base == null || property == null) {
throw new MethodNotFoundException(MessageFactory.get(
"error.method.notfound", base, property,
paramString(paramTypes)));
}
String methodName = property.toString();
Method method = getMethod(base.getClass(), methodName, paramTypes);
if (method == null) {
throw new MethodNotFoundException(MessageFactory.get(
"error.method.notfound", base, property,
paramString(paramTypes)));
}
return method;
|
private static java.lang.reflect.Method | getMethod(java.lang.Class cl, java.lang.String methodName, java.lang.Class[] paramTypes)
Method m = null;
try {
m = cl.getMethod(methodName, paramTypes);
} catch (NoSuchMethodException ex) {
return null;
}
Class dclass = m.getDeclaringClass();
if (Modifier.isPublic(dclass.getModifiers())) {
return m;
}
for (Class c: dclass.getInterfaces()) {
m = getMethod(c, methodName, paramTypes);
if (m != null) {
return m;
}
}
Class c = dclass.getSuperclass();
if (c != null) {
m = getMethod(c, methodName, paramTypes);
if (m != null) {
return m;
}
}
return null;
|
public static java.beans.PropertyDescriptor | getPropertyDescriptor(java.lang.Object base, java.lang.Object property)
String name = ELSupport.coerceToString(property);
PropertyDescriptor p = null;
try {
PropertyDescriptor[] desc = Introspector.getBeanInfo(
base.getClass()).getPropertyDescriptors();
for (int i = 0; i < desc.length; i++) {
if (desc[i].getName().equals(name)) {
return desc[i];
}
}
} catch (IntrospectionException ie) {
throw new ELException(ie);
}
throw new PropertyNotFoundException(MessageFactory.get(
"error.property.notfound", base, name));
|
protected static final java.lang.String | paramString(java.lang.Class[] types)
if (types != null) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < types.length; i++) {
sb.append(types[i].getName()).append(", ");
}
if (sb.length() > 2) {
sb.setLength(sb.length() - 2);
}
return sb.toString();
}
return null;
|
public static java.lang.Class[] | toTypeArray(java.lang.String[] s)Converts an array of Class names to Class types
if (s == null)
return null;
Class[] c = new Class[s.length];
for (int i = 0; i < s.length; i++) {
c[i] = forName(s[i]);
}
return c;
|
public static java.lang.String[] | toTypeNameArray(java.lang.Class[] c)Converts an array of Class types to Class names
if (c == null)
return null;
String[] s = new String[c.length];
for (int i = 0; i < c.length; i++) {
s[i] = c[i].getName();
}
return s;
|