当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils类代码示例

本文整理汇总了Java中org.eclipse.jgit.util.StringUtils的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringUtils类属于org.eclipse.jgit.util包,在下文中一共展示了StringUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
/**
 * Compare the two given git remote URIs. This method is a reimplementation of {@link URIish#equals(Object)} with
 * one difference. The scheme of the URIs is only considered if both URIs have a non-null and non-empty scheme part.
 *
 * @param lhs
 *            the left hand side
 * @param rhs
 *            the right hand side
 * @return <code>true</code> if the two URIs are to be considered equal and <code>false</code> otherwise
 */
private static boolean equals(URIish lhs, URIish rhs) {
	// We only consider the scheme if both URIs have one
	if (!StringUtils.isEmptyOrNull(lhs.getScheme()) && !StringUtils.isEmptyOrNull(rhs.getScheme())) {
		if (!Objects.equals(lhs.getScheme(), rhs.getScheme()))
			return false;
	}
	if (!equals(lhs.getUser(), rhs.getUser()))
		return false;
	if (!equals(lhs.getPass(), rhs.getPass()))
		return false;
	if (!equals(lhs.getHost(), rhs.getHost()))
		return false;
	if (lhs.getPort() != rhs.getPort())
		return false;
	if (!pathEquals(lhs.getPath(), rhs.getPath()))
		return false;
	return true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:GitUtils.java

示例2: pathEquals

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
private static boolean pathEquals(String lhs, String rhs) {
	if (StringUtils.isEmptyOrNull(lhs) && StringUtils.isEmptyOrNull(rhs))
		return true;

	// Skip leading slashes in both paths.
	int lhsIndex = 0;
	while (lhsIndex < lhs.length() && lhs.charAt(lhsIndex) == '/')
		++lhsIndex;

	int rhsIndex = 0;
	while (rhsIndex < rhs.length() && rhs.charAt(rhsIndex) == '/')
		++rhsIndex;

	String lhsRel = lhs.substring(lhsIndex);
	String rhsRel = rhs.substring(rhsIndex);
	return lhsRel.equals(rhsRel);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:GitUtils.java

示例3: trackerItemUpdated

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
@Override
public void trackerItemUpdated(BaseEvent<TrackerItemDto, TrackerItemDto, ActionData> event) throws VetoException {
    if(event.isPostEvent() && this.onIssueUpdated){
        TrackerItemDto issue = event.getSource();

        if(StringUtils.isEmptyOrNull(trackerIds) || isTargetIssue(issue)) {
            VelocityContext context = getDefaultVelocityContext(event);
            context.put("issue", event.getSource());

            TrackerItemUpdateDto itemUpdateDto = (TrackerItemUpdateDto) event.getData().getData();
            List<TrackerItemHistoryEntryDto> modifications = itemUpdateDto.getModifications();
            parseAndTruncateModifications(modifications);
            context.put("modifications", modifications);

            String message = renderTemplate(issueUpdatedTemplate, context, event);
            post(message);
        }
    }
}
 
开发者ID:CometKim,项目名称:cb-mattermost,代码行数:20,代码来源:MattermostNotifier.java

示例4: attachmentAdded

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
@Override
public void attachmentAdded(BaseEvent<TrackerItemAttachmentGroup, List<AccessPermissionDto>, ActionData> event) throws VetoException {
    if (event.isPostEvent() && this.onIssueCommented) {
        TrackerItemAttachmentGroup source = event.getSource();
        TrackerItemDto issue = source.getTrackerItem();

        if(StringUtils.isEmptyOrNull(trackerIds) || isTargetIssue(issue)) {
            VelocityContext context = getDefaultVelocityContext(event);

            context.put("issue", issue);

            String description = source.getDto().getDescription();
            String[] commentLines = description.split("\r\n");
            for (int i = 0, len = commentLines.length; i < len; i++) {
                commentLines[i] = commentLines[i].replace("\\\\", "  ");
            }
            context.put("commentLines", Arrays.asList(commentLines));

            String message = renderTemplate(issueCommentedTemplate, context, event);
            post(message);
        }
    }
}
 
开发者ID:CometKim,项目名称:cb-mattermost,代码行数:24,代码来源:MattermostNotifier.java

示例5: getOpenshiftVersion

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
private String getOpenshiftVersion() {
	String version = TestConfiguration.openshiftVersion();
	if(StringUtils.isEmptyOrNull(version)) {
		if (TestConfiguration.openshiftOnline()) return "N/A";

		String result = OpenShiftNode.master().executeCommand("oc version");
		version = result.replaceAll("(\n|.)*oc v(.*)\n(\n|.)*", "$2");
	}
	return version;
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:11,代码来源:OpenShiftBinaryClient.java

示例6: retrievePushedBy

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
private static String retrievePushedBy(final PushHook hook) {
    String userName = hook.getUserName();
    if (!StringUtils.isEmptyOrNull(userName)) {
        return userName;
    }

    final List<Commit> commits = hook.getCommits();
    if (commits != null && !commits.isEmpty()) {
        return commits.get(commits.size() - 1).getAuthor().getName();
    }

    return null;
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:14,代码来源:CauseDataHelper.java

示例7: trackerItemCreated

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
@Override
public void trackerItemCreated(BaseEvent<TrackerItemDto, TrackerItemDto, ActionData> event) throws VetoException {
    if(event.isPostEvent() && this.onIssueCreated){
        TrackerItemDto issue = event.getSource();

        if(StringUtils.isEmptyOrNull(trackerIds) || isTargetIssue(issue)) {
            VelocityContext context = getDefaultVelocityContext(event);
            context.put("issue", issue);

            String message = renderTemplate(issueCreatedTemplate, context, event);
            post(message);
        }
    }
}
 
开发者ID:CometKim,项目名称:cb-mattermost,代码行数:15,代码来源:MattermostNotifier.java

示例8: saveNotifySections

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
private void saveNotifySections(Config rc, Set<AccountGroup.UUID> keepGroups) {
  for (NotifyConfig nc : sort(notifySections.values())) {
    List<String> email = new ArrayList<>();
    for (GroupReference gr : nc.getGroups()) {
      if (gr.getUUID() != null) {
        keepGroups.add(gr.getUUID());
      }
      email.add(new PermissionRule(gr).asString(false));
    }
    Collections.sort(email);

    List<String> addrs = new ArrayList<>();
    for (Address addr : nc.getAddresses()) {
      addrs.add(addr.toString());
    }
    Collections.sort(addrs);
    email.addAll(addrs);

    set(rc, NOTIFY, nc.getName(), KEY_HEADER, nc.getHeader(), NotifyConfig.Header.BCC);
    if (email.isEmpty()) {
      rc.unset(NOTIFY, nc.getName(), KEY_EMAIL);
    } else {
      rc.setStringList(NOTIFY, nc.getName(), KEY_EMAIL, email);
    }

    if (nc.getNotify().equals(EnumSet.of(NotifyType.ALL))) {
      rc.unset(NOTIFY, nc.getName(), KEY_TYPE);
    } else {
      List<String> types = Lists.newArrayListWithCapacity(4);
      for (NotifyType t : NotifyType.values()) {
        if (nc.isNotify(t)) {
          types.add(StringUtils.toLowerCase(t.name()));
        }
      }
      rc.setStringList(NOTIFY, nc.getName(), KEY_TYPE, types);
    }

    set(rc, NOTIFY, nc.getName(), KEY_FILTER, nc.getFilter());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:41,代码来源:ProjectConfig.java

示例9: getStartPoint

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
protected ObjectId getStartPoint() throws RefNotFoundException, IOException {
    if (this.startCommit != null) {
        return this.startCommit.getId();
    }
    if (!StringUtils.isEmptyOrNull(this.startPoint)) {
        ObjectId oid = this.getRepository().resolve(this.startPoint);
        if (oid == null) {
            throw new RefNotFoundException(MessageFormat.format(
                    JGitText.get().refNotResolved, this.startPoint));
        }
        return oid;
    }
    return null;
}
 
开发者ID:windy1,项目名称:ghp-maven-plugin,代码行数:15,代码来源:CreateOrphanBranchCommand.java

示例10: doCheckName

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
public FormValidation doCheckName(@QueryParameter String id, @QueryParameter String value) {
    if (StringUtils.isEmptyOrNull(value)) {
        return FormValidation.error(Messages.name_required());
    } else if (connectionMap.containsKey(value) && !connectionMap.get(value).toString().equals(id)) {
        return FormValidation.error(Messages.name_exists(value));
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:10,代码来源:GitLabConnectionConfig.java

示例11: doCheckUrl

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
public FormValidation doCheckUrl(@QueryParameter String value) {
    if (StringUtils.isEmptyOrNull(value)) {
        return FormValidation.error(Messages.url_required());
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:8,代码来源:GitLabConnectionConfig.java

示例12: doCheckApiTokenId

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
public FormValidation doCheckApiTokenId(@QueryParameter String value) {
    if (StringUtils.isEmptyOrNull(value)) {
        return FormValidation.error(Messages.apiToken_required());
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:8,代码来源:GitLabConnectionConfig.java

示例13: retrievePushedBy

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
private String retrievePushedBy(final PushHook hook) {

        final String userName = hook.getUserName();
        if (!StringUtils.isEmptyOrNull(userName)) {
            return userName;
        }

        final List<Commit> commits = hook.getCommits();
        if (commits != null && !commits.isEmpty()) {
            return commits.get(commits.size() - 1).getAuthor().getName();
        }

        return null;
    }
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:15,代码来源:PushHookTriggerHandlerImpl.java

示例14: getStartPoint

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
protected ObjectId getStartPoint() throws RefNotFoundException, IOException {
	if (this.startCommit != null) {
		return this.startCommit.getId();
	}
	if (StringUtils.isEmptyOrNull(this.startPoint) == false) {
		ObjectId oid = this.getRepository().resolve(this.startPoint);
		if (oid == null) {
			throw new RefNotFoundException(MessageFormat.format(
				JGitText.get().refNotResolved, this.startPoint));
		}
		return oid;
	}
	return null;
}
 
开发者ID:uw-loci,项目名称:github-backup-java,代码行数:15,代码来源:CreateOrphanBranchCommand.java

示例15: withStrategies

import org.eclipse.jgit.util.StringUtils; //导入依赖的package包/类
public TestConfiguration.Builder withStrategies(Collection<String> strategies) {
    this.strategies = StringUtils.join(strategies, ",");
    return this;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:5,代码来源:TestConfiguration.java


注:本文中的org.eclipse.jgit.util.StringUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。