View Javadoc
1   /**
2    * Copyright By Grandsoft Company Limited.  
3    * 2013-9-16 下午03:57:41
4    */
5   package gboat2.web.util;
6   
7   import gboat2.base.core.model.Parameter;
8   import gboat2.base.core.service.IParameterService;
9   import gboat2.base.core.util.SpringContextUtil;
10  
11  /**
12   * 
13   * 参数工具类
14   * @author zhangxj-a
15   * @since jdk1.6
16   * @date 2013-9-16
17   *  
18   */
19  public abstract class ParameterUtil {
20  	private ParameterUtil() {
21  		super();
22  		// TODO Auto-generated constructor stub
23  	}
24  	
25  	/**
26  	 * 初始化参数或者获得参数的值
27  	 * @param jsonOfParameter
28  	 * @return
29  	 */
30  	public static Parameter getParameter(String jsonOfParameter){
31  		return getParameterService().getParameter(jsonOfParameter);
32  	}
33  	
34  	
35  	/**
36  	 * 根据code
37  	 * @param code
38  	 * @return
39  	 */
40  	public static Parameter getParameterByCode(String code){
41  		return getParameterService().getParameterByCode(code);
42  	}
43  	
44  	/**
45  	 * 根据code 获取参数值
46  	 * @param code
47  	 * @return
48  	 */
49  	public static String getValueByCode(String code){
50  		return getParameterService().getValueByCode(code);
51  	}
52  	
53  	/**
54  	 * 判断是否已经存在code
55  	 * @param code
56  	 * @return
57  	 */
58  	public static boolean hasCodeByCode(String code){
59  		return getParameterService().hasCodeByCode(code);
60  	}
61  	
62  	
63  	private static IParameterService getParameterService() {
64  		return (IParameterService) SpringContextUtil.getInstance().getBeanOfId("parameteServiceH");
65  	}
66  }