📄 resourcebundleservicepropertyhandlerutil.java
字号:
if (path != null && path.trim().equals("")) {
path = null;
}
} catch (MissingResourceException e) {
path = null;
}
return path;
}
/**
* 傾僾儕働乕僔儑儞ID偵奩摉偡傞僷儔儊乕僞柤傪庢摼偟傑偡丅
* 愝掕偝傟偰偄側偄応崌丄{@link ServicePropertyHandler#DEFAULT_APPLICATION_PARAMETER}偱掕媊偝傟偰偄傞抣傪曉偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 傾僾儕働乕僔儑儞ID偵奩摉偡傞僷儔儊乕僞柤
* @throws MissingResourceException 傾僾儕働乕僔儑儞ID偵奩摉偡傞僷儔儊乕僞柤偺庢摼帪偵椺奜偑敪惗
*/
public static String getApplicationParamName(ResourceBundle commonBundle) {
try {
return commonBundle.getString("application.param");
} catch (MissingResourceException e) {
return ServicePropertyHandler.DEFAULT_APPLICATION_PARAMETER;
}
}
/**
* 僒乕價僗ID偵奩摉偡傞僷儔儊乕僞柤傪庢摼偟傑偡丅
* 愝掕偝傟偰偄側偄応崌丄{@link ServicePropertyHandler#DEFAULT_SERVICE_PARAMETER}偱掕媊偝傟偰偄傞抣傪曉偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 僒乕價僗ID偵奩摉偡傞僷儔儊乕僞柤
* @throws MissingResourceException 僒乕價僗ID偵奩摉偡傞僷儔儊乕僞柤偺庢摼帪偵椺奜偑敪惗
*/
public static String getServiceParamName(ResourceBundle commonBundle) {
try {
return commonBundle.getString("service.param");
} catch (MissingResourceException e) {
return ServicePropertyHandler.DEFAULT_SERVICE_PARAMETER;
}
}
/**
* 椺奜儁乕僕偵慗堏偡傞偲偒偵javax.servlet.http.HttpServletRequest偵椺奜忣曬傪懏惈偲偟偰捛壛偡傞応崌偺懏惈柤傪庢摼偟傑偡丅
* 愝掕偝傟偰偄側偄応崌丄{@link ServicePropertyHandler#DEFAULT_EXCEPTION_ATTRIBUTE}偱掕媊偝傟偰偄傞抣傪曉偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 椺奜偺懏惈柤
* @throws MissingResourceException 懏惈柤偺庢摼帪偵椺奜偑敪惗
*/
public static String getExceptionAttributeName(ResourceBundle commonBundle)
throws MissingResourceException {
return commonBundle.getString("exception.attirbute");
}
/**
* 僉儍僢僔儏忣曬傪偡傋偰庢摼偟傑偡丅
* {@link CacheRuleInfo}傪掕媊偝傟偨弴斣偱僜乕僩偟偨Collection偲偟偰庢摼偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 僉儍僢僔儏忣曬偺堦棗
* @throws ServicePropertyException 僉儍僢僔儏忣曬偺庢摼帪偵椺奜偑敪惗
* @see CacheRule
* @see Cache
* @see CacheCondition
* @since 4.2
*/
// public static Collection getCacheRuleInfos(ResourceBundle commonBundle)
// throws ServicePropertyException {
// Enumeration enum = null;
// CacheRuleInfo info = null;
// TreeMap infos = new TreeMap();
// ResourceBundle targetBundle = null;
// String conditionPrefix = "cache.rule.condition.class.";
// String conditionParamPrefix = "cache.rule.condition.param.";
// HashMap conditionParamMap = new HashMap();
// String cachePrefix = "cache.rule.cache.class.";
// String cacheParamPrefix = "cache.rule.cache.param.";
// HashMap cacheParamMap = new HashMap();
// String conditionKey = null;
// String cacheKey = null;
// String conditionName = null;
// String cacheName = null;
// String option = null;
// int num = 0;
//
// // 儕僜乕僗偐傜偡傋偰偺僉乕傪庢摼偡傞
// enum = commonBundle.getKeys();
//
// // 僉儍僢僔儏偵奩摉偡傞僾儘僷僥傿偡傋偰偵懳偟偰孞傝曉偟張棟傪偡傞
// while (enum.hasMoreElements()) {
// conditionKey = (String)enum.nextElement();
// if (conditionKey.startsWith(conditionPrefix)) {
// info = new CacheRuleInfo();
//
// // 僜乕僩斣崋傪愝掕偡傞
// num =
// Integer.parseInt(
// conditionKey.substring(conditionPrefix.length()));
//
// // 僉儍僢僔儏忦審偺僋儔僗柤傪愝掕偡傞
// try {
// conditionName = commonBundle.getString(conditionKey);
// } catch (MissingResourceException e) {
// String message = null;
// try {
// message =
// ResourceBundle
// .getBundle("jp.co.intra_mart.framework.base.service.i18n")
// .getString("ResourceBundleServicePropertyHandlerUtil.FailedToGetCacheCondition");
// } catch (MissingResourceException ex) {
// }
// throw new ServicePropertyException(
// message + " : key = " + conditionKey,
// e);
// }
// if (conditionName == null || conditionName.equals("")) {
// // 僉儍僢僔儏忦審偺僋儔僗柤傪庢摼偱偒側偄応崌椺奜傪throw
// String message = null;
// try {
// message =
// ResourceBundle
// .getBundle("jp.co.intra_mart.framework.base.service.i18n")
// .getString("ResourceBundleServicePropertyHandlerUtil.CacheConditionNotDeclared");
// } catch (MissingResourceException ex) {
// }
// throw new ServicePropertyException(
// message + " : key = " + conditionKey);
// }
// info.setCondition(conditionName);
//
// // 僉儍僢僔儏偺僋儔僗柤傪愝掕偡傞
// cacheKey = cachePrefix + num;
// try {
// cacheName = commonBundle.getString(cacheKey);
// } catch (MissingResourceException e) {
// String message = null;
// try {
// message =
// ResourceBundle
// .getBundle("jp.co.intra_mart.framework.base.service.i18n")
// .getString("ResourceBundleServicePropertyHandlerUtil.FailedToGetCache");
// } catch (MissingResourceException ex) {
// }
// throw new ServicePropertyException(
// message + " : key = " + cacheKey,
// e);
// }
// if (cacheName == null || cacheName.equals("")) {
// // 僉儍僢僔儏偺僋儔僗柤傪庢摼偱偒側偄応崌椺奜傪throw
// String message = null;
// try {
// message =
// ResourceBundle
// .getBundle("jp.co.intra_mart.framework.base.service.i18n")
// .getString("ResourceBundleServicePropertyHandlerUtil.CacheNotDeclared");
// } catch (MissingResourceException ex) {
// }
// throw new ServicePropertyException(
// message + " : key = " + cacheKey);
// }
// info.setCache(cacheName);
//
// // 僉儍僢僔儏忣曬傪捛壛偡傞
// infos.put(new Integer(num), info);
// } else if (conditionKey.startsWith(conditionParamPrefix)) {
// int sortKeyIndex =
// conditionKey.indexOf(".", conditionParamPrefix.length());
// String number =
// conditionKey.substring(
// conditionParamPrefix.length(),
// sortKeyIndex);
// String conditionParamName =
// conditionKey.substring(sortKeyIndex);
// PropertyParam conditionParam = new PropertyParam();
// conditionParam.setName(conditionParamName);
// conditionParam.setValue(commonBundle.getString(conditionKey));
// Vector innerConditionParams =
// (Vector)conditionParamMap.get(new Integer(number));
// if (innerConditionParams == null) {
// innerConditionParams = new Vector();
// conditionParamMap.put(
// new Integer(number),
// innerConditionParams);
// }
// innerConditionParams.add(conditionParam);
// } else if (conditionKey.startsWith(cacheParamPrefix)) {
// int sortKeyIndex =
// conditionKey.indexOf(".", cacheParamPrefix.length());
// String number =
// conditionKey.substring(
// cacheParamPrefix.length(),
// sortKeyIndex);
// String conditionParamName =
// conditionKey.substring(sortKeyIndex);
// PropertyParam cacheParam = new PropertyParam();
// cacheParam.setName(conditionParamName);
// cacheParam.setValue(commonBundle.getString(conditionKey));
// Vector innerCacheParams =
// (Vector)cacheParamMap.get(new Integer(number));
// if (innerCacheParams == null) {
// innerCacheParams = new Vector();
// cacheParamMap.put(new Integer(number), innerCacheParams);
// }
// innerCacheParams.add(cacheParam);
// }
// }
//
// Iterator iter = infos.keySet().iterator();
// while (iter.hasNext()) {
// Integer ruleInfoKey = (Integer)iter.next();
// CacheRuleInfo ruleInfo = (CacheRuleInfo)infos.get(ruleInfoKey);
//
// // 僉儍僢僔儏忦審僷儔儊乕僞偺愝掕
// PropertyParam[] conditionParams = null;
// Vector innerConditionParams =
// (Vector)conditionParamMap.get(ruleInfoKey);
// if (innerConditionParams != null) {
// conditionParams =
// new PropertyParam[innerConditionParams.size()];
// for (int i = 0; i < innerConditionParams.size(); i++) {
// conditionParams[i] =
// (PropertyParam)innerConditionParams.elementAt(i);
// }
// }
// ruleInfo.setConditionParameters(conditionParams);
//
// // 僉儍僢僔儏僷儔儊乕僞偺愝掕
// PropertyParam[] cacheParams = null;
// Vector innerCacheParams = (Vector)cacheParamMap.get(ruleInfoKey);
// if (innerCacheParams != null) {
// cacheParams = new PropertyParam[innerCacheParams.size()];
// for (int i = 0; i < innerCacheParams.size(); i++) {
// cacheParams[i] =
// (PropertyParam)innerCacheParams.elementAt(i);
// }
// }
// ruleInfo.setCacheParameters(conditionParams);
// }
//
// return infos.values();
// }
/**
* 儘僌僀儞儐乕僓偑巊梡偡傞僄儞僐乕僪傪曐懚偟偰偍偔偲偒偺懏惈柤傪庢摼偟傑偡丅
* 愝掕偝傟偰偄側偄応崌丄{@link ServicePropertyHandler#DEFAULT_ENCODING_ATTRIBUTE}偱掕媊偝傟偰偄傞抣傪曉偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 僄儞僐乕僪偺懏惈柤
*/
public static String getEncodingAttributeName(ResourceBundle commonBundle) {
try {
return commonBundle.getString("encoding.attribute");
} catch (MissingResourceException e) {
return ServicePropertyHandler.DEFAULT_ENCODING_ATTRIBUTE;
}
}
/**
* 儘僌僀儞儐乕僓偑巊梡偡傞儘働乕儖傪曐懚偟偰偍偔偲偒偺懏惈柤傪庢摼偟傑偡丅
* 愝掕偝傟偰偄側偄応崌丄{@link ServicePropertyHandler#DEFAULT_LOCALE_ATTRIBUTE}偱掕媊偝傟偰偄傞抣傪曉偟傑偡丅
*
* @param commonBundle 嫟捠偺儕僜乕僗僶儞僪儖
* @return 儘働乕儖偺懏惈柤
*/
public static String getLocaleAttributeName(ResourceBundle commonBundle) {
try {
return commonBundle.getString("locale.attribute");
} catch (MissingResourceException e) {
return ServicePropertyHandler.DEFAULT_LOCALE_ATTRIBUTE;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -