本文整理匯總了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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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();
}
}
}
示例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());
}
}
示例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;
}
示例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: 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;
}
示例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{
}
}
示例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);
}
}
示例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" ;
}
示例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;
}
示例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;
}