当前位置: 首页>>代码示例>>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;未经允许,请勿转载。