@@ -0,0 +1,2264 @@
+package me.allenz.zlog;%0A%0Aimport java.lang.reflect.Field;%0Aimport java.lang.reflect.Modifier;%0A%0A/**%0A * Utility tools.%0A * %0A * @author Allenz%0A * @since 0.10.-RELEASE%0A */%0Apublic class Utils %7B%0A%0A%09private Utils() %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09/**%0A%09 * Get the integer value of static field the declared in specified class.%0A%09 * %0A%09 * @param className%0A%09 *            the fullname of the class%0A%09 * @param fieldName%0A%09 *            the name of the field%0A%09 * @param defaultValue%0A%09 *            the default value to return when failed to get value of the%0A%09 *            field%0A%09 * @return the value of the field when successed, or the default value when%0A%09 *         failure%0A%09 */%0A%09public int intReflectStaticFieldValue(final String className,%0A%09%09%09final String fieldName, final int defaultValue) %7B%0A%09%09try %7B%0A%09%09%09final Class%3C?%3E clazz = Class.forName(className);%0A%09%09%09final Field field = clazz.getDeclaredField(fieldName);%0A%09%09%09if (Modifier.isStatic(field.getModifiers())%0A%09%09%09%09%09&& field.getType().getName().equals(%22int%22)) %7B%0A%09%09%09%09field.setAccessible(true);%0A%09%09%09%09return field.getInt(null);%0A%09%09%09%7D%0A%09%09%7D catch (final Exception e) %7B%0A%09%09%09LoggerFactory.getInternalLogger().warn(e,%0A%09%09%09%09%09%22Can not get the value of %25s.%25s%22, className, fieldName);%0A%09%09%7D%0A%09%09return defaultValue;%0A%09%7D%0A%0A%09/**%0A%09 * Get the boolean value of static field the declared in specified class.%0A%09 * %0A%09 * @param className%0A%09 *            the fullname of the class%0A%09 * @param fieldName%0A%09 *            the name of the field%0A%09 * @param defaultValue%0A%09 *            the default value to return when failed to get value of the%0A%09 *            field%0A%09 * @return the value of the field when successed, or the default value when%0A%09 *         failure%0A%09 */%0A%09public boolean booleanReflectStaticFieldValue(final String className,%0A%09%09%09final String fieldName, final boolean defaultValue) %7B%0A%09%09try %7B%0A%09%09%09final Class%3C?%3E clazz = Class.forName(className);%0A%09%09%09final Field field = clazz.getDeclaredField(fieldName);%0A%09%09%09if (Modifier.isStatic(field.getModifiers())%0A%09%09%09%09%09&& field.getType().getName().equals(%22int%22)) %7B%0A%09%09%09%09field.setAccessible(true);%0A%09%09%09%09return field.getBoolean(null);%0A%09%09%09%7D%0A%09%09%7D catch (final Exception e) %7B%0A%09%09%09LoggerFactory.getInternalLogger().warn(e,%0A%09%09%09%09%09%22Can not get the value of %25s.%25s%22, className, fieldName);%0A%09%09%7D%0A%09%09return defaultValue;%0A%09%7D%0A%7D%0A

add class Utils