private static void setValueStatic(Class<?> targetClass, String staticProperty, Object value) {
Method staticSetter = ReflectionUtils.getSetter(targetClass, staticProperty, true);
if (staticSetter != null) {
try {
invokeMethod(targetClass, staticSetter, value);
} catch (InvocationTargetException e) {
throw new UnitilsException("Exception thrown by target", e);
}
} else {
Field staticField = getFieldWithName(targetClass, staticProperty, true);
if (staticField == null) {
throw new UnitilsException("Static property named " + staticProperty + " not found on class " + targetClass.getSimpleName());
}
setFieldValue(targetClass, staticField, value);
}
}
}