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


Java StringUtils.startsWith方法代碼示例

本文整理匯總了Java中org.apache.commons.lang.StringUtils.startsWith方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.startsWith方法的具體用法?Java StringUtils.startsWith怎麽用?Java StringUtils.startsWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang.StringUtils的用法示例。


在下文中一共展示了StringUtils.startsWith方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: currentAllowAdminAccess

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void currentAllowAdminAccess() {
    if (securityAdvisorTL.get() == null) {
        // only set the advisor if there is not already one
        SecurityAdvisor securityAdvisor = new SecurityAdvisor() {
            public SecurityAdvice isAllowed(String userId, String function, String reference) {
                if (StringUtils.startsWith(function, KALTURA_PREFIX)) {
                    return SecurityAdvice.ALLOWED;
                }
                return SecurityAdvice.PASS;
            }
        };
        securityAdvisorTL.set(securityAdvisor);
    }
    securityService.pushAdvisor( securityAdvisorTL.get() );
    if (StringUtils.isBlank(getCurrentUserId())) {
        // force a current user to the admin if there is not one right now
        String adminUserRef = developerHelperService.getUserRefFromUserId(getAdminUserId());
        developerHelperService.setCurrentUser(adminUserRef);
    }
}
 
開發者ID:ITYug,項目名稱:kaltura-ce-sakai-extension,代碼行數:21,代碼來源:SakaiExternalLogicImpl.java

示例2: 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

示例3: buildEndpointUrl

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private String buildEndpointUrl(String endpoint) {
    if (StringUtils.startsWith(endpoint, "/")) {
        if (StringUtils.isBlank(getHost())) {
            throw new ConfigurationException("rest.host");
        }

        try {
            new URL(getHost());
        } catch (MalformedURLException e) {
            throw new ConfigurationException("rest.host", e.getMessage());
        }

        return getHost() + endpoint;
    } else {
        return endpoint;
    }
}
 
開發者ID:kamax-io,項目名稱:mxisd,代碼行數:18,代碼來源:RestBackendConfig.java

示例4: restartHydrograph

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private void restartHydrograph() {
	logger.info("Starting New Hydrograph");
	String path = Platform.getInstallLocation().getURL().getPath();
	if ((StringUtils.isNotBlank(path)) && (StringUtils.startsWith(path, "/")) && (OSValidator.isWindows())) {
		path = StringUtils.substring(path, 1);
	}
	String command = path + HYDROGRAPH_EXE;
	Runtime runtime = Runtime.getRuntime();
	try {
		if (OSValidator.isWindows()) {
			String[] commandArray = { "cmd.exe", "/c", command };
			runtime.exec(commandArray);
		}
	} catch (IOException ioException) {
		logger.error("Exception occurred while starting hydrograph" + ioException);
	}
	System.exit(0);
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:PreStartActivity.java

示例5: closeDataViewerWindows

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void closeDataViewerWindows(Job job) {
	if(job==null){
		return;
	}
	
	List<DebugDataViewer> dataViewerList = new ArrayList<>(); 
	dataViewerList.addAll(JobManager.INSTANCE.getDataViewerMap().values());
			
	Iterator<DebugDataViewer> iterator = dataViewerList.iterator();
	while(iterator.hasNext()){
		
		DebugDataViewer daDebugDataViewer = (DebugDataViewer) iterator.next();
		String windowName=(String) daDebugDataViewer.getDataViewerWindowTitle();
		if(StringUtils.startsWith(windowName, job.getConsoleName().replace(".", "_"))){
			daDebugDataViewer.close();	
			JobManager.INSTANCE.getDataViewerMap().remove(windowName);
			iterator.remove();
		}
		
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:DataViewerUtility.java

示例6: getTemplateContent

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private String getTemplateContent(String location) {
    try {
        InputStream is = StringUtils.startsWith(location, "classpath:") ?
                app.getResource(location).getInputStream() : new FileInputStream(location);
        return IOUtils.toString(is, StandardCharsets.UTF_8);
    } catch (IOException e) {
        throw new InternalServerError("Unable to read template content at " + location + ": " + e.getMessage());
    }
}
 
開發者ID:kamax-io,項目名稱:mxisd,代碼行數:10,代碼來源:GenericTemplateNotificationGenerator.java

示例7: getName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected static String getName(String path) {
    if (StringUtils.startsWith(path, classpathPrefix)) {
        return "Built-in (" + path.substring(classpathPrefix.length()) + ")";
    }

    return path;
}
 
開發者ID:kamax-io,項目名稱:mxisd,代碼行數:8,代碼來源:GenericTemplateConfig.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: getSrcPackageFragment

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@SuppressWarnings("restriction")
public PackageFragmentRoot getSrcPackageFragment(IJavaProject iJavaProject) throws JavaModelException {
	for(IPackageFragmentRoot iPackageFragmentRoot:iJavaProject.getAllPackageFragmentRoots()){
		if(iPackageFragmentRoot instanceof PackageFragmentRoot && iPackageFragmentRoot.getKind()==iPackageFragmentRoot.K_SOURCE){
			if(StringUtils.startsWith(iPackageFragmentRoot.toString(),hydrograph.ui.common.util.Constants.ProjectSupport_SRC)){
				return (PackageFragmentRoot) iPackageFragmentRoot;
			}
		}
	}
	return null;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:BuildExpressionEditorDataSturcture.java

示例11: performSelectionActivity

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private void performSelectionActivity(List methodsList){
	if (methodsList.getItemCount() != 0
			&& !StringUtils.startsWith(methodsList.getItem(0),Messages.CANNOT_SEARCH_INPUT_STRING)) {
		MethodDetails methodDetails = (MethodDetails) methodsList.getData(String.valueOf(methodsList
				.getSelectionIndex()));
		if (methodDetails != null && StringUtils.isNotBlank(methodDetails.getJavaDoc())) {
			descriptionStyledText.setText(methodDetails.getJavaDoc());
		} else {
			descriptionStyledText.setText(Messages.JAVA_DOC_NOT_AVAILABLE);
		}
	}else{
		
	}
		
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:16,代碼來源:FunctionsComposite.java

示例12: insert

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Override
public void insert(String string) {
	if (!StringUtils.startsWith(StringUtils.trim(string),Messages.CANNOT_SEARCH_INPUT_STRING)) {
		super.insert(string);
		this.setFocus();
		this.setSelection(this.getText().length() + 100);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:9,代碼來源:ExpressionEditorStyledText.java

示例13: getInstallationConfigPath

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private static String getInstallationConfigPath()  {
	String path = Platform.getInstallLocation().getURL().getPath();
	if(StringUtils.isNotBlank(path) && StringUtils.startsWith(path, "/") && OSValidator.isWindows()){
		path = StringUtils.substring(path, 1);
	}
	
	return path + "config/service/config" ;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:9,代碼來源:ApplicationWorkbenchWindowAdvisor.java

示例14: containsName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * Looks up whether the metric name contains the given prefix keywords.
 * Note that the keywords are separated with comma as delimiter
 *
 * @param full the original metric name that to be compared with
 * @param prefixes the prefix keywords that are matched against with the metric name
 * @return boolean value that denotes whether the metric name starts with the given prefix
 */
protected boolean containsName(String full, String prefixes) {
    String[] prefixArray = StringUtils.split(prefixes, ",");
    for (String prefix : prefixArray) {
        if (StringUtils.startsWith(full, StringUtils.trimToEmpty(prefix))) {
            return true;
        }
    }
    return false;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:18,代碼來源:DefaultGangliaMetricsReporter.java

示例15: containsName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * Looks up whether the metric name contains the given prefix keywords.
 * Note that the keywords are separated with comma as delimiter.
 *
 * @param full the original metric name that to be compared with
 * @param prefixes the prefix keywords that are matched against with the metric name
 * @return boolean value that denotes whether the metric name starts with the given prefix
 */
protected boolean containsName(String full, String prefixes) {
    String[] prefixArray = StringUtils.split(prefixes, ",");
    for (String prefix : prefixArray) {
        if (StringUtils.startsWith(full, StringUtils.trimToEmpty(prefix))) {
            return true;
        }
    }
    return false;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:18,代碼來源:DefaultInfluxDbMetricsReporter.java


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