本文整理汇总了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;
}