{
return field.getType().getName();
}
else
{
throw new ValidateException(bundle.wrongAnnotationType(annotation));
}
}
catch (NoSuchFieldException nsfe)
{
clz = clz.getSuperclass();
}
}
}
else if (annotation.isOnMethod())
{
Class clz = Class.forName(annotation.getClassName(), true, classLoader);
Class[] parameters = null;
if (annotation.getParameterTypes() != null)
{
parameters = new Class[annotation.getParameterTypes().size()];
for (int i = 0; i < annotation.getParameterTypes().size(); i++)
{
String parameter = annotation.getParameterTypes().get(i);
parameters[i] = Class.forName(parameter, true, classLoader);
}
}
while (!Object.class.equals(clz))
{
try
{
Method method = clz.getDeclaredMethod(annotation.getMemberName(), parameters);
if (void.class.equals(method.getReturnType()))
{
if (parameters != null && parameters.length > 0)
{
if (type == null || type.equals(Object.class) || type.equals(parameters[0]))
{
return parameters[0].getName();
}
else
{
throw new ValidateException(bundle.wrongAnnotationType(annotation));
}
}
}
else
{
if (type == null || type.equals(Object.class) || type.equals(method.getReturnType()))
{
return method.getReturnType().getName();
}
else
{
throw new ValidateException(bundle.wrongAnnotationType(annotation));
}
}
}
catch (NoSuchMethodException nsme)
{