一、前言
关于taobao的gecko源码包(1.1.4)中com.taobao.gecko.core.util.PropertyUtils属性工具类,可以将属性值获取转换对应基本数据类型处理,详情源码说明。
二、源码说明
package com.taobao.gecko.core.util;@b@@b@import java.util.Properties;@b@@b@public class PropertyUtils@b@{@b@ public static int getPropertyAsInteger(Properties props, String propName)@b@ {@b@ return Integer.parseInt(getProperty(props, propName));@b@ }@b@@b@ public static String getProperty(Properties props, String name)@b@ {@b@ return props.getProperty(name).trim();@b@ }@b@@b@ public static boolean getPropertyAsBoolean(Properties props, String name)@b@ {@b@ return Boolean.valueOf(getProperty(props, name)).booleanValue();@b@ }@b@@b@ public static long getPropertyAsLong(Properties props, String name)@b@ {@b@ return Long.parseLong(getProperty(props, name));@b@ }@b@@b@ public static short getPropertyAsShort(Properties props, String name)@b@ {@b@ return Short.parseShort(getProperty(props, name));@b@ }@b@@b@ public static byte getPropertyAsByte(Properties props, String name)@b@ {@b@ return Byte.parseByte(getProperty(props, name));@b@ }@b@}