当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.contains方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringUtils.contains方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.contains方法的具体用法?Java StringUtils.contains怎么用?Java StringUtils.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: find

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Path find() throws BackgroundException {
    final Path home = super.find();
    if(home == DEFAULT_HOME) {
        final String user;
        final Credentials credentials = session.getHost().getCredentials();
        if(StringUtils.contains(credentials.getUsername(), ':')) {
            user = StringUtils.splitPreserveAllTokens(credentials.getUsername(), ':')[1];
        }
        else {
            user = credentials.getUsername();
        }
        return new Path(new StringBuilder()
                .append(Path.DELIMITER).append(session.getRegion())
                .append(Path.DELIMITER).append("home")
                .append(Path.DELIMITER).append(user)
                .toString(), EnumSet.of(Path.Type.directory, Path.Type.volume));
    }
    return home;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:21,代码来源:IRODSHomeFinderService.java

示例2: map

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public BackgroundException map(final IOException failure) {
    final Throwable[] stack = ExceptionUtils.getThrowables(failure);
    for(Throwable t : stack) {
        if(t instanceof BackgroundException) {
            return (BackgroundException) t;
        }
    }
    if(failure instanceof SSLException) {
        return new SSLExceptionMappingService().map((SSLException) failure);
    }
    final StringBuilder buffer = new StringBuilder();
    this.append(buffer, failure.getMessage());
    for(Throwable cause : ExceptionUtils.getThrowableList(failure)) {
        if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) {
            this.append(buffer, cause.getMessage());
        }
    }
    return this.wrap(failure, buffer);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:21,代码来源:DefaultIOExceptionMappingService.java

示例3: getDBType

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 获取数据库类型
 */
public static Database getDBType(DataSource dataSource){
	String jdbcUrl = getJdbcUrlFromDataSource(dataSource);
	
	if (StringUtils.contains(jdbcUrl, ":h2:")) {
		return Database.H2 ;
	} else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
		return Database.MYSQL ;
	} else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
		return Database.ORACLE ;
	} else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
		return Database.POSTGRESQL ;
	} else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
		return Database.SQL_SERVER ;
	}
	throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:20,代码来源:JPAUtil.java

示例4: getDisplayName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * @param locale ISO Language identifier
 * @return Human readable language name in the target language
 */
public String getDisplayName(final String locale) {
    java.util.Locale l;
    if(StringUtils.contains(locale, "_")) {
        l = new java.util.Locale(locale.split("_")[0], locale.split("_")[1]);
    }
    else {
        l = new java.util.Locale(locale);
    }
    return StringUtils.capitalize(l.getDisplayName(l));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:Preferences.java

示例5: removeTimeZone

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private static String removeTimeZone(String dateTime) {
    if (dateTime == null)
        return null;

    if (StringUtils.contains(dateTime, "+"))
        return Helpers.split(dateTime, "+").get(0);
    else if (StringUtils.contains(dateTime, "-"))
        return Helpers.split(dateTime, "-").get(0);

    return dateTime;
}
 
开发者ID:endeavourhealth,项目名称:HL7Receiver,代码行数:12,代码来源:DateParser.java

示例6: getByName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public ServiceDefinition getByName(String name) throws JAXBException, IOException {
	ServiceDefinition data = new ServiceDefinition();
	ArrayList<String> sDefs = util.getResourcesWithExtension("srvc", containerName);
	Unmarshaller unmarshaller = JAXBContext.newInstance(ServiceDefinition.class).createUnmarshaller();
	for (String sDef : sDefs) {
		File file = new File(sDef);
		if (file.exists() && StringUtils.contains(file.getName(), name)) {
			String content = FileUtils.readFileToString(file);
			data = (ServiceDefinition) unmarshaller.unmarshal(new StringReader(content));
			break;
		}
	}
	return data;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:15,代码来源:ServicesUtil.java

示例7: getLastComponent

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getLastComponent(String fullName) {
    if (! StringUtils.contains(fullName, ".")) {
        return fullName;
    }
    int index = fullName.lastIndexOf('.');
    return fullName.substring(index + 1);
}
 
开发者ID:Sixt,项目名称:ja-micro,代码行数:8,代码来源:RegistrationManager.java

示例8: getByName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public ComponentType getByName(String name) throws JAXBException, IOException {
	ComponentType data = new ComponentType();
	ArrayList<String> cDefs = util.getResourcesWithExtension("cdef", containerName);
	Unmarshaller unmarshaller = JAXBContext.newInstance(ComponentType.class).createUnmarshaller();
	for (String cDef : cDefs) {
		File file = new File(cDef);
		if (file.exists() && StringUtils.contains(file.getName(), name)) {
			String content = FileUtils.readFileToString(file);
			data = ((JAXBElement<ComponentType>) unmarshaller.unmarshal(new StringReader(content))).getValue();
			break;
		}
	}
	return data;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:15,代码来源:CompDefUtil.java

示例9: setReferer

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 设置Referer
 * 
 */
public static void setReferer() {
    String refererPath = (String) ServletActionContext.getRequest().getHeader(REFERER_KEY);
    // 如果URL里没有本站域名的话,设置本站域名为默认值
    if (!(StringUtils.contains(refererPath, YiDuConstants.yiduConf.getString(YiDuConfig.URI)) && StringUtils
            .contains(refererPath, YiDuConstants.yiduConf.getString(YiDuConfig.URI)))) {
        refererPath = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
    }
    HttpSession session = getSession(true);
    logger.debug("REFERER_KEY : " + refererPath);
    session.setAttribute(REFERER_KEY, refererPath);
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:16,代码来源:LoginManager.java

示例10: relativize

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String relativize(String root, final String path) {
    if(StringUtils.isBlank(root)) {
        return path;
    }
    if(!StringUtils.equals(root, String.valueOf(Path.DELIMITER))) {
        root = root + String.valueOf(Path.DELIMITER);
    }
    if(StringUtils.contains(path, root)) {
        return StringUtils.substring(path, path.indexOf(root) + root.length());
    }
    return path;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:13,代码来源:PathRelativizer.java

示例11: removeEmptyTags

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String removeEmptyTags(String string, Class clazz) {
	String ret = "";
	ArrayList<String> fin = new ArrayList<String>();
	if (StringUtils.contains(string, "\"\"")) {
		String[] brk = StringUtils.split(string, " ");
		for (String str : brk) {
			if (!StringUtils.contains(str, "\"\""))
				fin.add(str);
			else if (StringUtils.contains(str, "/>"))
				fin.add("/>");
			else if (StringUtils.contains(str, ">"))
				fin.add(">");
		}
	}
	if (fin.size() > 0)
		for (String val : fin) {
			ret += val + " ";
		}
	else
		ret = string;
	try {
		JAXBContext ctx = JAXBContext.newInstance(clazz);
		Unmarshaller unmarshaller = ctx.createUnmarshaller();
		MarshallerImpl marshaller = (MarshallerImpl) ctx.createMarshaller();
		marshaller.setProperty(MarshallerImpl.JAXB_FORMATTED_OUTPUT, true);
		marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new NamespacePrefixMapper());
		StringWriter writer = new StringWriter();
		marshaller.marshal(unmarshaller.unmarshal(new StringReader(ret)), writer);
		ret = writer.toString();
	} catch (Exception e) {
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:34,代码来源:ParseUtil.java

示例12: wasSuccessful

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean wasSuccessful() {
  return StringUtils.contains(output, SvnUtils.REVISION)
      && !StringUtils.contains(output, SvnUtils.SVN_ERROR_PREFIX);
}
 
开发者ID:lpavone,项目名称:SVNAutoMerger,代码行数:6,代码来源:UpdateBranch.java

示例13: getRegion

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected String getRegion() {
    if(StringUtils.contains(host.getRegion(), ':')) {
        return StringUtils.splitPreserveAllTokens(host.getRegion(), ':')[0];
    }
    return host.getRegion();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:7,代码来源:IRODSSession.java

示例14: accept

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean accept(File arg0) {
	return !(StringUtils.contains(arg0.getAbsolutePath(), "model"));
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:5,代码来源:CopyrightAmend.java

示例15: isPartJSON

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private boolean isPartJSON(Map<String, String> headers) {
    String contentType = getMultipartHeaderValue(headers, HttpConfig.HttpHeaders.CONTENT_TYPE);
    return StringUtils.contains(contentType, HttpConfig.ContentTypes.JSON);
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:5,代码来源:MultipartParser.java


注:本文中的org.apache.commons.lang3.StringUtils.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。