本文整理匯總了Java中org.apache.commons.lang.StringUtils.stripToNull方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.stripToNull方法的具體用法?Java StringUtils.stripToNull怎麽用?Java StringUtils.stripToNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.stripToNull方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseDescriptor
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* @deprecated See: {@link #parseDescriptor(Map, Map, String)}
* @param launch_info Variable is mutated by this method.
* @param postProp Variable is mutated by this method.
* @param descriptor
* @return
*/
public static boolean parseDescriptor(Properties launch_info,
Properties postProp, String descriptor) {
// this is an ugly copy/paste of the [email protected] method
// could not convert data types as they variables get mutated (ugh)
Map<String, Object> tm = null;
try {
tm = XMLMap.getFullMap(descriptor.trim());
} catch (Exception e) {
M_log.warning("BasicLTIUtil exception parsing BasicLTI descriptor: "
+ e.getMessage());
return false;
}
if (tm == null) {
M_log.warning("Unable to parse XML in parseDescriptor");
return false;
}
String launch_url = StringUtils.stripToNull(XMLMap.getString(tm, "/basic_lti_link/launch_url"));
String secure_launch_url = StringUtils.stripToNull(XMLMap.getString(tm, "/basic_lti_link/secure_launch_url"));
if (launch_url == null && secure_launch_url == null) {
return false;
}
setProperty(launch_info, "launch_url", launch_url);
setProperty(launch_info, "secure_launch_url", secure_launch_url);
// Extensions for hand-authored placements - The export process should scrub these
setProperty(launch_info, "key", StringUtils.stripToNull(XMLMap.getString(tm, "/basic_lti_link/x-secure/launch_key")));
setProperty(launch_info, "secret", StringUtils.stripToNull(XMLMap.getString(tm, "/basic_lti_link/x-secure/launch_secret")));
List<Map<String, Object>> theList = XMLMap.getList(tm, "/basic_lti_link/custom/parameter");
for (Map<String, Object> setting : theList) {
dPrint("Setting=" + setting);
String key = XMLMap.getString(setting, "/!key"); // Get the key attribute
String value = XMLMap.getString(setting, "/"); // Get the value
if (key == null || value == null) {
continue;
}
key = "custom_" + mapKeyName(key);
dPrint("key=" + key + " val=" + value);
postProp.setProperty(key, value);
}
return true;
}