Method getter = null;
boolean readOnly = false;
if (type == Void.TYPE) { //check for setter
Class<?>[] types = method.getParameterTypes();
if (types.length != 1) {
throw new TeiidRuntimeException("TranslatorProperty annotation should be placed on valid getter or setter method, " + method + " is not valid."); //$NON-NLS-1$ //$NON-NLS-2$
}
type = types[0];
try {
getter = instance.getClass().getMethod("get" + method.getName(), (Class[])null); //$NON-NLS-1$
} catch (Exception e) {
try {
getter = instance.getClass().getMethod("get" + method.getName().substring(3), (Class[])null); //$NON-NLS-1$
} catch (Exception e1) {
//can't find getter, won't set the default value
}
}
} else if (method.getParameterTypes().length != 0) {
throw new TeiidRuntimeException("TranslatorProperty annotation should be placed on valid getter or setter method, " + method + " is not valid."); //$NON-NLS-1$ //$NON-NLS-2$
} else {
getter = method;
try {
TranslatorUtil.getSetter(instance.getClass(), method);
} catch (Exception e) {
readOnly = true;
}
}
Object defaultValue = null;
if (prop.required()) {
if (prop.advanced()) {
throw new TeiidRuntimeException("TranslatorProperty annotation should not both be advanced and required " + method); //$NON-NLS-1$
}
} else if (getter != null) {
try {
defaultValue = getter.invoke(instance, (Object[])null);
} catch (Exception e) {