當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.endsWith方法代碼示例

本文整理匯總了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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:IntegerOrParameterValidationRule.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:29,代碼來源:PreStartActivity.java

示例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 );
}
 
開發者ID:dataloom,項目名稱:integrations,代碼行數:34,代碼來源:MadisonPoliceDept.java

示例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());
    }
}
 
開發者ID:suninformation,項目名稱:ymate-module-sso,代碼行數:50,代碼來源:DefaultModuleCfg.java

示例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);
        }
    }
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:37,代碼來源:CreateSiteMapJob.java

示例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);
        }
    }
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:39,代碼來源:CreateSiteMapJob.java

示例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);
        }
    }
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:31,代碼來源:CreateStructuringDataJob.java

示例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;
}
 
開發者ID:suninformation,項目名稱:ymate-payment-v2,代碼行數:11,代碼來源:WxPayAccountMeta.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:14,代碼來源:FTPProtocolSelectionValidator.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:ExpressionEditorUtil.java

示例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;
		}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:SchemaHelper.java

示例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" );
}
 
開發者ID:dataloom,項目名稱:integrations,代碼行數:6,代碼來源:ConvertImages.java


注:本文中的org.apache.commons.lang.StringUtils.endsWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。