首页

关于taobao的gecko包中的PropertyUtils属性工具类获取常用转换基本数据类型值源码说明

标签:gecko,PropertyUtils,属性工具类,taobao     发布时间:2019-01-08   

一、前言

关于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@}