本文整理汇总了Java中org.apache.commons.lang.StringUtils.startsWithIgnoreCase方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.startsWithIgnoreCase方法的具体用法?Java StringUtils.startsWithIgnoreCase怎么用?Java StringUtils.startsWithIgnoreCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.startsWithIgnoreCase方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
protected DbDialect generate(JdbcTemplate jdbcTemplate, String databaseName, int databaseMajorVersion,
int databaseMinorVersion, DataMediaType dataMediaType) {
DbDialect dialect = null;
if (StringUtils.startsWithIgnoreCase(databaseName, ORACLE)) { // for
// oracle
dialect = new OracleDialect(jdbcTemplate, oracleLobHandler, databaseName, databaseMajorVersion,
databaseMinorVersion);
} else if (StringUtils.startsWithIgnoreCase(databaseName, MYSQL)) { // for
// mysql
dialect = new MysqlDialect(jdbcTemplate, defaultLobHandler, databaseName, databaseMajorVersion,
databaseMinorVersion);
} else if (StringUtils.startsWithIgnoreCase(databaseName, TDDL_GROUP)) { // for
// tddl
// group
throw new RuntimeException(databaseName + " type is not support!");
} else if (StringUtils.startsWithIgnoreCase(databaseName, TDDL_CLIENT)) {
throw new RuntimeException(databaseName + " type is not support!");
}
// diamond is delegated to mysql/oracle, so don't need to extend here
return dialect;
}
示例2: execute
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
* @return 提交请求并返回回应结果
* @throws Exception 可能产生的任何异常
*/
public RESPONSE execute() throws Exception {
Map<String, Object> _params = buildSignatureParams();
_params.put(IWxPay.Const.SIGN, __doCreateSignature(_params, __accountMeta.getMchKey()));
// 处理沙箱URL地址
String _requestURL = __doGetRequestURL();
if (!StringUtils.startsWithIgnoreCase(_requestURL, "http")) {
_requestURL = "https://api.mch.weixin.qq.com/" + __accountMeta.getSandboxPrefix() + _requestURL;
}
IHttpResponse _response = HttpClientHelper.create()
.customSSL(__accountMeta.getConnectionSocketFactory())
.post(_requestURL, __doBuildXML(_params));
if (_response != null) {
if (_response.getStatusCode() == 200) {
return __doParseResponse(_response);
} else if (_LOG.isDebugEnabled()) {
_LOG.debug("ResponseBody: " + _response.toString());
}
}
return null;
}
示例3: DefaultModuleCfg
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public DefaultModuleCfg(YMP owner) {
Map<String, String> _moduleCfgs = owner.getConfig().getModuleConfigs(ISSO.MODULE_NAME);
//
__tokenCookieName = StringUtils.defaultIfBlank(_moduleCfgs.get("token_cookie_name"), ISSO.MODULE_NAME + "_token");
//
__tokenHeaderName = StringUtils.defaultIfBlank(_moduleCfgs.get("token_header_name"), "X-ModuleSSO-Token");
//
__tokenParamName = StringUtils.defaultIfBlank(_moduleCfgs.get("token_param_name"), "token");
//
__tokenMaxage = BlurObject.bind(_moduleCfgs.get("token_maxage")).toIntValue();
//
__tokenValidateTimeInterval = BlurObject.bind(_moduleCfgs.get("token_validate_time_interval")).toIntValue();
//
__cacheNamePrefix = StringUtils.trimToEmpty(_moduleCfgs.get("cache_name_prefix"));
//
__multiSessionEnabled = BlurObject.bind(_moduleCfgs.get("multi_session_enabled")).toBooleanValue();
//
__ipCheckEnabled = BlurObject.bind(_moduleCfgs.get("ip_check_enabled")).toBooleanValue();
//
__isClientMode = BlurObject.bind(_moduleCfgs.get("client_mode")).toBooleanValue();
//
__serviceAuthKey = StringUtils.trimToEmpty(_moduleCfgs.get("service_auth_key"));
//
if (__isClientMode) {
__serviceBaseUrl = StringUtils.trimToNull(_moduleCfgs.get("service_base_url"));
if (__serviceBaseUrl != null) {
if (!StringUtils.startsWithIgnoreCase(__serviceBaseUrl, "http://") &&
!StringUtils.startsWithIgnoreCase(__serviceBaseUrl, "https://")) {
throw new IllegalArgumentException("The parameter service_base_url is invalid");
} else if (!StringUtils.endsWith(__serviceBaseUrl, "/")) {
__serviceBaseUrl = __serviceBaseUrl + "/";
}
}
}
//
__tokenApater = ClassUtils.impl(_moduleCfgs.get("token_adapter_class"), ISSOTokenAdapter.class, getClass());
if (__tokenApater == null) {
__tokenApater = new DefaultSSOTokenAdapter();
}
//
__tokenStorageAdapter = ClassUtils.impl(_moduleCfgs.get("storage_adapter_class"), ISSOTokenStorageAdapter.class, getClass());
if (!__isClientMode && __tokenStorageAdapter == null) {
throw new IllegalArgumentException("The parameter storage_adapter_class is invalid");
}
//
if (!__isClientMode) {
__tokenAttributeAdapter = ClassUtils.impl(_moduleCfgs.get("attribute_adapter_class"), ISSOTokenAttributeAdapter.class, getClass());
}
}
示例4: convertKalturaMetadataToFieldsList
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
* Method to process the KalturaMetadata object (and the XML it contains) into a list of field strings
* @param metadata kaltura metadata object
* @return List of field strings
*/
private List<String> convertKalturaMetadataToFieldsList(KalturaMetadata metadata) {
List<String> fields = new ArrayList<String>();
// if metadata exists for object
if (metadata != null && StringUtils.isNotEmpty(metadata.xml)) {
// check for malformed beginning of XML
String metadataXml = metadata.xml;
if (StringUtils.startsWithIgnoreCase(metadataXml, "xml=")){
metadataXml = metadataXml.replaceAll("xml=", "");
}
// ensure XML begins with the <?xml tag
int lastIndex = StringUtils.lastIndexOf(metadataXml, "<?xml");
if(lastIndex > 0){
metadataXml = StringUtils.substring(metadataXml, lastIndex);
}
// set the metadata's XML to the updated string
metadata.xml = metadataXml;
try {
Document metadataDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(metadata.xml)));
org.w3c.dom.Element root = metadataDoc.getDocumentElement();
NodeList childNodes = root.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node instanceof org.w3c.dom.Element) {
fields.add(node.getTextContent());
}
}
} catch (Exception e) {
throw new RuntimeException("Error processing metadata fields for kaltura metadata object (" + metadata.objectId + ") :: " + e + ", xml="+metadata.xml, e);
}
}
return fields;
}
示例5: getTags
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public InstanceTags getTags(String name) throws Exception {
InstanceTags tags = new InstanceTags();
String matchName = name;
//All docker instances have been added a prefix cmp-. For ex:
// pinshot-04215101
// cmp-pinshot-newkernel-0a0111e9
// To find out the tag, we need to get rid of the prefix.
//
if (StringUtils.isNotEmpty(name) && StringUtils.startsWithIgnoreCase(name, "cmp-")) {
matchName = name.substring(4);
}
List<EsServiceMapping>
mappings =
InstanceTagger.getInstance().findMapping(matchName);
HashSet<String> serviceMapping = new HashSet<>();
HashSet<String> svcTag = new HashSet<>();
HashSet<String> sysTag = new HashSet<>();
HashSet<String> usageTag = new HashSet<>();
for (EsServiceMapping mapping : mappings) {
serviceMapping.add(mapping.getName());
svcTag.add(mapping.getServiceTag());
sysTag.add(mapping.getSysTag());
if (!StringUtils.equals(mapping.getUsageTag(), "n/a")) {
usageTag.add(mapping.getUsageTag());
}
}
tags.setServiceMappings(serviceMapping.toArray(new String[serviceMapping.size()]));
tags.setSvcTags(svcTag.toArray(new String[svcTag.size()]));
tags.setSysTags(sysTag.toArray(new String[sysTag.size()]));
tags.setUsageTags(usageTag.toArray(new String[usageTag.size()]));
return tags;
}
示例6: DefaultModuleCfg
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public DefaultModuleCfg(YMP owner) {
Map<String, String> _moduleCfgs = owner.getConfig().getModuleConfigs(IAliPay.MODULE_NAME);
//
__gatewayUrl = StringUtils.defaultIfBlank(_moduleCfgs.get("gateway_url"), "https://openapi.alipay.com/gateway.do");
if (!StringUtils.startsWithIgnoreCase(__gatewayUrl, "https://") && !StringUtils.startsWithIgnoreCase(__gatewayUrl, "http://")) {
throw new IllegalArgumentException("gateway_url address is invalid");
}
//
__accountProvider = ClassUtils.impl(_moduleCfgs.get("account_provider_class"), IAliPayAccountProvider.class, getClass());
if (__accountProvider == null) {
__accountProvider = new DefaultAliPayAccountProvider();
//
AliPayAccountMeta _meta = new AliPayAccountMeta(_moduleCfgs.get(IAliPay.Const.APP_ID), _moduleCfgs.get(IAliPay.Const.SIGN_TYPE), _moduleCfgs.get("private_key"), _moduleCfgs.get("public_key"));
_meta.setCharset(StringUtils.defaultIfBlank(_moduleCfgs.get(IAliPay.Const.CHARSET), IAliPay.Const.CHARSET_UTF8));
_meta.setFormat(StringUtils.defaultIfBlank(_moduleCfgs.get(IAliPay.Const.FORMAT), IAliPay.Const.FORMAT_JSON));
_meta.setNotifyUrl(StringUtils.trimToNull(_moduleCfgs.get(IAliPay.Const.NOTIFY_URL)));
_meta.setReturnUrl(StringUtils.trimToNull(_moduleCfgs.get(IAliPay.Const.RETURN_URL)));
//
__defaultAccountId = _meta.getAppId();
__accountProvider.registerAccount(_meta);
} else {
__defaultAccountId = StringUtils.trimToNull(_moduleCfgs.get("default_account_id"));
}
//
__eventHandler = ClassUtils.impl(_moduleCfgs.get("event_handler_class"), IAliPayEventHandler.class, getClass());
if (__eventHandler == null) {
throw new NullArgumentException("event_handler_class");
}
//
__signCheckDisabled = BlurObject.bind(_moduleCfgs.get("sign_check_disabled")).toBooleanValue();
}
示例7: getPortIndex
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getPortIndex(Link link) {
if(StringUtils.startsWithIgnoreCase(link.getSourceTerminal(), Constants.INPUT_SOCKET_TYPE)){
return StringUtils.remove(link.getSourceTerminal(), Constants.INPUT_SOCKET_TYPE);
}else {
return StringUtils.remove(link.getSourceTerminal(), Constants.OUTPUT_SOCKET_TYPE);
}
}
示例8: getPortCount
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getPortCount(String sourceTerminalId) {
String portCount=null;
if(StringUtils.startsWithIgnoreCase(sourceTerminalId, Constants.UNUSED_SOCKET_TYPE)){
portCount=StringUtils.remove(sourceTerminalId, Constants.UNUSED_SOCKET_TYPE);
}else if(StringUtils.startsWithIgnoreCase(sourceTerminalId, Constants.OUTPUT_SOCKET_TYPE)){
portCount=StringUtils.remove(sourceTerminalId, Constants.OUTPUT_SOCKET_TYPE);
}
return portCount;
}
示例9: getPortIndex
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private String getPortIndex(Link link) {
if(StringUtils.startsWithIgnoreCase(link.getSourceTerminal(), Constants.INPUT_SOCKET_TYPE)){
return StringUtils.remove(link.getSourceTerminal(), Constants.INPUT_SOCKET_TYPE);
}else {
return StringUtils.remove(link.getSourceTerminal(), Constants.OUTPUT_SOCKET_TYPE);
}
}
示例10: onTabComplete
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
List<String> rtrn = null;
if (label.startsWith(name)) {
label = label.replaceFirst(name, "");
}
/*
* Auto Complete normal para cada comando si está declarado
*/
for (WCCmd cmdr : cmds) {
if (cmdr.getName().equals(label) || cmdr.getAliases().contains(label)) {
try {
if ((sender instanceof Player) && (!WCServer.getUser((Player) sender).hasPermission(cmdr.getPermiso())) && !cmdr.getPermiso().equalsIgnoreCase("")) {
return new ArrayList<>();
}
rtrn = cmdr.onTabComplete(sender, cmd, label, args, args[args.length - 1], args.length - 1);
} catch (Exception ex) {
WCCore.getInstance().log(WCServer.Level.WARNING, "Fallo al autocompletar " + label);
}
break;
}
}
/*
* Si el autocomplete es null, que devuelva jugadores
*/
if (rtrn == null) {
rtrn = new ArrayList<>();
for (Player p : Bukkit.getOnlinePlayers()) {
rtrn.add(p.getName());
}
}
/*
* Autocomplete para cada argumento
*/
ArrayList<String> rtrn2 = new ArrayList<>();
rtrn2.addAll(rtrn);
rtrn = rtrn2;
if (!(args[args.length - 1].isEmpty() || args[args.length - 1] == null)) {
List<String> remv = new ArrayList<>();
for (String s : rtrn) {
if (!StringUtils.startsWithIgnoreCase(s, args[args.length - 1])) {
remv.add(s);
}
}
rtrn.removeAll(remv);
}
return rtrn;
}
示例11: doEdit
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
* 修改canal
*/
public void doEdit(@FormGroup("canalInfo") Group canalInfo,
@FormGroup("canalParameterInfo") Group canalParameterInfo,
@FormField(name = "formCanalError", group = "canalInfo") CustomErrors err,
@FormField(name = "formHeartBeatError", group = "canalParameterInfo") CustomErrors heartBeatErr,
Navigator nav) throws Exception {
Canal canal = new Canal();
CanalParameter parameter = new CanalParameter();
canalInfo.setProperties(canal);
canalParameterInfo.setProperties(parameter);
String zkClustersString = canalParameterInfo.getField("zkClusters").getStringValue();
String[] zkClusters = StringUtils.split(zkClustersString, ";");
parameter.setZkClusters(Arrays.asList(zkClusters));
Long zkClusterId = canalParameterInfo.getField("autoKeeperClusterId").getLongValue();
parameter.setZkClusterId(zkClusterId);
String dbAddressesString = canalParameterInfo.getField("groupDbAddresses").getStringValue();
if (StringUtils.isNotEmpty(dbAddressesString)) {
List<List<DataSourcing>> dbSocketAddress = new ArrayList<List<DataSourcing>>();
String[] dbAddresses = StringUtils.split(dbAddressesString, ";");
for (String dbAddressString : dbAddresses) {
List<DataSourcing> groupDbSocketAddress = new ArrayList<DataSourcing>();
String[] groupDbAddresses = StringUtils.split(dbAddressString, ",");
for (String groupDbAddress : groupDbAddresses) {
String strs[] = StringUtils.split(groupDbAddress, ":");
InetSocketAddress address = new InetSocketAddress(strs[0].trim(), Integer.valueOf(strs[1]));
SourcingType type = parameter.getSourcingType();
if (strs.length > 2) {
type = SourcingType.valueOf(strs[2]);
}
groupDbSocketAddress.add(new DataSourcing(type, address));
}
dbSocketAddress.add(groupDbSocketAddress);
}
parameter.setGroupDbAddresses(dbSocketAddress);
}
String positionsString = canalParameterInfo.getField("positions").getStringValue();
if (StringUtils.isNotEmpty(positionsString)) {
String positions[] = StringUtils.split(positionsString, ";");
parameter.setPositions(Arrays.asList(positions));
}
if (parameter.getDetectingEnable() && StringUtils.startsWithIgnoreCase(parameter.getDetectingSQL(), "select")) {
heartBeatErr.setMessage("invaliedHeartBeat");
return;
}
canal.setCanalParameter(parameter);
try {
canalService.modify(canal);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidCanal");
return;
}
nav.redirectToLocation("canalList.htm");
}
示例12: isMediaPushDataSource
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static boolean isMediaPushDataSource(String url) {
return StringUtils.startsWithIgnoreCase(url, "jdbc:") && StringUtils.containsIgnoreCase(url, "groupKey");
}
示例13: onTabComplete
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
List<String> rtrn = null;
if (label.startsWith(name)) {
label = label.replaceFirst(name, "");
}
/*
* Auto Complete normal para cada comando si está declarado
*/
for (PACmd cmdr : cmds) {
if (cmdr.getName().equals(label) || cmdr.getAliases().contains(label)) {
try {
if ((sender instanceof Player) && (!PAServer.getUser((Player) sender).isOnRank(cmdr.getGroup()))) {
return new ArrayList<>();
}
rtrn = cmdr.onTabComplete(sender, cmd, label, args, args[args.length - 1], args.length - 1);
} catch (Exception ex) {
Log.log(Log.Level.WARNING, "Fallo al autocompletar " + label);
}
break;
}
}
/*
* Si el autocomplete es null, que devuelva jugadores
*/
if (rtrn == null) {
rtrn = new ArrayList<>();
for (Player p : Bukkit.getOnlinePlayers()) {
rtrn.add(p.getName());
}
}
/*
* Autocomplete para cada argumento
*/
ArrayList<String> rtrn2 = new ArrayList<>();
rtrn2.addAll(rtrn);
rtrn = rtrn2;
if (!(args[args.length - 1].isEmpty() || args[args.length - 1] == null)) {
List<String> remv = new ArrayList<>();
for (String s : rtrn) {
if (!StringUtils.startsWithIgnoreCase(s, args[args.length - 1])) {
remv.add(s);
}
}
rtrn.removeAll(remv);
}
return rtrn;
}