本文整理汇总了Java中org.apache.commons.lang.StringUtils.endsWith方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.endsWith方法的具体用法?Java StringUtils.endsWith怎么用?Java StringUtils.endsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.endsWith方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public boolean validate(Object object, String propertyName,Map<String,List<FixedWidthGridRow>> inputSchemaMap,
boolean isJobImported){
String value = (String) object;
if(StringUtils.isNotBlank(value)){
Matcher matcher=Pattern.compile("[\\d]*").matcher(value);
if((matcher.matches())||
((StringUtils.startsWith(value, "@{") && StringUtils.endsWith(value, "}")) &&
!StringUtils.contains(value, "@{}"))){
return true;
}
errorMessage = propertyName + " is mandatory";
}
errorMessage = propertyName + " is not integer value or valid parameter";
return false;
}
示例2: isValidJDKPath
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
* Checks whether given JDK-PATH is valid or not.
*
* @param javaHome
* input jdk path
* @param showPopUp
* true if user wants to show pop for invalid path.
* @return
* true if input string is valid JDK path.
*/
public static boolean isValidJDKPath(String javaHome,boolean showPopUp) {
try{
if(javaHome !=null && isValidDirectory(javaHome,showPopUp)){
if (StringUtils.endsWith(javaHome, SLASH_BIN)) {
javaHome = StringUtils.replace(javaHome, SLASH_BIN, "");
}
if (StringUtils.isNotBlank(javaHome)) {
StringBuffer jdkPath = new StringBuffer(javaHome);
jdkPath = jdkPath.delete(0, jdkPath.lastIndexOf("\\") + 1);
return checkJDKVersion(jdkPath.toString(), showPopUp);
}
}
}
catch (Exception exception) {
logger.warn("Exception occurred while validating javaHome path",exception);
}
return false;
}
示例3: safeParse
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static String safeParse( Row row ) {
String date = row.getAs( "Date" );
String time = row.getAs( "Time" );
if ( StringUtils.endsWith( date, "/10" ) ) {
date = "2010";
}
if ( StringUtils.endsWith( date, "/11" ) ) {
date = "2011";
}
if ( StringUtils.endsWith( date, "/12" ) ) {
date = "2012";
}
if ( StringUtils.endsWith( date, "/13" ) ) {
date = "2013";
}
if ( StringUtils.endsWith( date, "/14" ) ) {
date = "2014";
}
if ( StringUtils.endsWith( date, "/15" ) ) {
date = "2015";
}
if ( StringUtils.endsWith( date, "/16" ) ) {
date = "2016";
}
if ( StringUtils.endsWith( date, "/17" ) ) {
date = "2017";
}
if ( date.contains( "#" ) || time.contains( "#" ) ) {
return null;
}
return dtHelper.parse( date + " " + time );
}
示例4: 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());
}
}
示例5: executeInternal
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
log.debug("CreateSiteMapJob start.");
boolean createSiteMapFlag = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_SITEMAP, false);
if (createSiteMapFlag) {
String uri = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
String sitemapUri = uri + (StringUtils.endsWith(uri, "/") ? "" : "/") + SITEMAP_DIR + "/";
try {
String currentPath = CreateSiteMapJob.class.getClassLoader().getResource("").getPath();
File f = new File(currentPath).getParentFile().getParentFile();
currentPath = f.getAbsolutePath();
log.debug(currentPath);
String sitemapDir = currentPath + "/" + SITEMAP_DIR + "/";
log.debug("sitemap dir: " + sitemapDir);
if (!new File(sitemapDir).exists()) {
new File(sitemapDir).mkdirs();
}
if (SiteMapType.XML.getName().equalsIgnoreCase(
YiDuConstants.yiduConf.getString(YiDuConfig.SITEMAP_TYPE))) {
createXmlSiteMap(sitemapDir, sitemapUri, false);
createXmlSiteMap(sitemapDir, sitemapUri, true);
} else {
String responseBody = Utils.getContentFromUri(uri + SiteMapAction.URL);
if (StringUtils.isNotBlank(responseBody)) {
File destFile = new File(sitemapDir + "/index.html");
FileUtils.writeFile(destFile, responseBody, false);
}
}
log.debug("CreateSiteMapJob normally end.");
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
示例6: executeInternal
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
log.debug("CreateSiteMapJob start.");
boolean createSiteMapFlag = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_SITEMAP, false);
if (createSiteMapFlag) {
String uri = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
String sitemapUri = uri + (StringUtils.endsWith(uri, "/") ? "" : "/") + SITEMAP_DIR + "/";
try {
String currentPath = CreateSiteMapJob.class.getClassLoader().getResource("").getPath();
File f = new File(currentPath).getParentFile().getParentFile();
currentPath = f.getAbsolutePath();
log.debug(currentPath);
String sitemapDir = currentPath + "/" + SITEMAP_DIR + "/";
log.debug("sitemap dir: " + sitemapDir);
if (!new File(sitemapDir).exists()) {
new File(sitemapDir).mkdirs();
}
if (SiteMapType.XML.getName().equalsIgnoreCase(
YiDuConstants.yiduConf.getString(YiDuConfig.SITEMAP_TYPE))) {
createXmlSiteMap(sitemapDir, sitemapUri, false);
uri = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILE_URI);
sitemapUri = uri + (StringUtils.endsWith(uri, "/") ? "" : "/") + SITEMAP_DIR + "/";
createXmlSiteMap(sitemapDir, sitemapUri, true);
} else {
String responseBody = Utils.getContentFromUri(uri + SiteMapAction.URL);
if (StringUtils.isNotBlank(responseBody)) {
File destFile = new File(sitemapDir + "/index.html");
FileUtils.writeFile(destFile, responseBody, false);
}
}
log.debug("CreateSiteMapJob normally end.");
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
示例7: executeInternal
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
log.debug("CreateStructuringDataJob start.");
boolean createStructuringDataFlag = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_STRUCTURINGDATA, false);
if (createStructuringDataFlag) {
String uri = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
String sitemapUri = uri + (StringUtils.endsWith(uri, "/") ? "" : "/") + STRUCTURINGDATA_DIR + "/";
try {
String currentPath = CreateSiteMapJob.class.getClassLoader().getResource("").getPath();
File f = new File(currentPath).getParentFile().getParentFile();
currentPath = f.getAbsolutePath();
log.debug(currentPath);
String sitemapDir = currentPath + "/" + STRUCTURINGDATA_DIR + "/";
log.debug("sitemap dir: " + sitemapDir);
if (!new File(sitemapDir).exists()) {
new File(sitemapDir).mkdirs();
}
createXmlSiteMap(sitemapDir, sitemapUri, false);
uri = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILE_URI);
sitemapUri = uri + (StringUtils.endsWith(uri, "/") ? "" : "/") + STRUCTURINGDATA_DIR + "/";
createXmlSiteMap(sitemapDir, sitemapUri, true);
log.debug("CreateStructuringDataJob normally end.");
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
示例8: setSandboxPrefix
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public void setSandboxPrefix(String sandboxPrefix) {
sandboxPrefix = StringUtils.defaultIfBlank(sandboxPrefix, "sandboxnew");
if (StringUtils.startsWith(sandboxPrefix, "/")) {
sandboxPrefix = StringUtils.substringAfter(sandboxPrefix, "/");
}
if (!StringUtils.endsWith(this.sandboxPrefix, "/")) {
sandboxPrefix = sandboxPrefix + "/";
}
this.sandboxPrefix = sandboxPrefix;
}
示例9: validatePort
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private boolean validatePort(String text, String propertyName){
if(StringUtils.isNotBlank(text)){
Matcher matcher=Pattern.compile("[\\d]*").matcher(text);
if((matcher.matches())||
((StringUtils.startsWith(text, "@{") && StringUtils.endsWith(text, "}")) &&
!StringUtils.contains(text, "@{}"))){
return true;
}
errorMessage = propertyName + " is mandatory";
}
errorMessage = propertyName + " is not integer value or valid parameter";
return false;
}
示例10: lastString
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public String lastString(String field, String seperator) {
String result = Constants.EMPTY_STRING;
if (StringUtils.isNotBlank(field)) {
String[] strArray = StringUtils.split(field, seperator);
result = strArray[strArray.length - 1];
if (StringUtils.endsWith(result, Constants.SEMICOLON)) {
result = StringUtils.remove(result, Constants.SEMICOLON);
}
}
return result;
}
示例11: validatePath
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
* This function will return file path with validation
* @param path
* @return validPath
*/
public String validatePath(String path){
String validPath = null;
if(StringUtils.endsWith(path,File.separator)){
return path;
}else{
validPath = path + File.separator;
return validPath;
}
}
示例12: isImage
import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static boolean isImage( String path ) {
return StringUtils.endsWith( path, ".jpg" )
|| StringUtils.endsWith( path, ".png" )
|| StringUtils.endsWith( path, ".gif" );
}