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


Java NonNull类代码示例

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


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

示例1: buildTemplateWithRemote

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * Builds a {@link UriTemplate} from the supplied template and the {@link GitSCMSource#getRemote()}.
 * @param template the template, must include {@code {+server}} for the server and {@code {?p}} for the project.
 * @param remote the {@link GitSCMSource#getRemote()}.
 * @return the template.
 * @throws IOException if the remote is unknown.
 */
static UriTemplate buildTemplateWithRemote(String template, @NonNull String remote) throws IOException {
    UriTemplate result;
    String server = null;
    String p = null;
    for (String prefix : GIT_WEB_HOSTS) {
        if (remote.startsWith(prefix + "/")) {
            server = prefix;
            p = remote.substring(prefix.length() + 1);
            break;
        }
    }
    if (server == null) {
        throw new IOException("Unknown remote: " + remote);
    }

    result = UriTemplate.fromTemplate(template);
    result.set("server", server).set("p", p);
    return result;
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:27,代码来源:ASFGitSCMFileSystem.java

示例2: isExcluded

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) {
    if (head instanceof BranchSCMHead && request instanceof GiteaSCMSourceRequest) {
        for (GiteaPullRequest p : ((GiteaSCMSourceRequest) request).getPullRequests()) {
            if (p.getBase().getRepo().getOwner().getUsername()
                    .equalsIgnoreCase(p.getHead().getRepo().getOwner().getUsername())
                    && p.getBase().getRepo().getName().equalsIgnoreCase(p.getHead().getRepo().getName())
                    && !p.getHead().getRef().equals(head.getName())) {
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:19,代码来源:BranchDiscoveryTrait.java

示例3: GiteaServer

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * @param displayName   Optional name to use to describe the end-point.
 * @param serverUrl     The URL of this Bitbucket Server
 * @param manageHooks   {@code true} if and only if Jenkins is supposed to auto-manage hooks for this end-point.
 * @param credentialsId The {@link StandardUsernamePasswordCredentials#getId()} of the credentials to use for
 *                      auto-management of hooks.
 */
@DataBoundConstructor
public GiteaServer(@CheckForNull String displayName, @NonNull String serverUrl, boolean manageHooks,
                   @CheckForNull String credentialsId) {
    this.manageHooks = manageHooks && StringUtils.isNotBlank(credentialsId);
    this.credentialsId = manageHooks ? credentialsId : null;
    this.serverUrl = GiteaServers.normalizeServerUrl(serverUrl);
    this.displayName = StringUtils.isBlank(displayName)
            ? SCMName.fromUrl(this.serverUrl, COMMON_PREFIX_HOSTNAMES)
            : displayName;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:18,代码来源:GiteaServer.java

示例4: updateServer

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * Updates an existing endpoint (or adds if missing).
 *
 * @param endpoint the endpoint to update.
 */
public synchronized void updateServer(@NonNull GiteaServer endpoint) {
    List<GiteaServer> endpoints = new ArrayList<>(getServers());
    boolean found = false;
    for (int i = 0; i < endpoints.size(); i++) {
        GiteaServer ep = endpoints.get(i);
        if (ep.getServerUrl().equals(endpoint.getServerUrl())) {
            endpoints.set(i, endpoint);
            found = true;
            break;
        }
    }
    if (!found) {
        endpoints.add(endpoint);
    }
    setServers(endpoints);
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:22,代码来源:GiteaServers.java

示例5: isMatch

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@Override
public boolean isMatch(@NonNull SCM scm) {
    if (scm instanceof GitSCM && !disableNotifyScm) {
        GitSCM git = (GitSCM) scm;
        if (git.getExtensions().get(IgnoreNotifyCommit.class) != null) {
            return false;
        }
        for (RemoteConfig repository : git.getRepositories()) {
            for (URIish remoteUri : repository.getURIs()) {
                if (GitStatus.looselyMatches(this.remoteUri, remoteUri)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:18,代码来源:GitPubSubPoll.java

示例6: descriptionFor

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String descriptionFor(@NonNull SCMNavigator navigator) {
    GiteaPullRequestEventType action = getPayload().getAction();
    if (action != null) {
        switch (action) {
            case OPENED:
                return "Pull request #" + getPayload().getNumber() + " opened in repository " + getPayload()
                        .getRepository().getName();
            case REOPENED:
                return "Pull request #" + getPayload().getNumber() + " reopened in repository " + getPayload()
                        .getRepository().getName();
            case CLOSED:
                return "Pull request #" + getPayload().getNumber() + " closed in repository " + getPayload()
                        .getRepository().getName();
        }
    }
    return "Pull request #" + getPayload().getNumber() + " event in repository " + getPayload().getRepository()
            .getName();
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:23,代码来源:GiteaPullSCMEvent.java

示例7: retrieveActions

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@NonNull
@Override
protected List<Action> retrieveActions(@NonNull SCMNavigatorOwner owner, SCMNavigatorEvent event,
                                       @NonNull TaskListener listener) throws IOException, InterruptedException {
    List<Action> result = new ArrayList<>(super.retrieveActions(owner, event, listener));
    ASFGitSCMNavigatorContext context = new ASFGitSCMNavigatorContext().withTraits(traits);
    String avatarUrl = context.avatarUrl();
    if (avatarUrl != null) {
        String avatarDescription = context.avatarDescription();
        result.add(new ASFAvatarMetadataAction(avatarUrl, avatarDescription));
    }
    String objectUrl = context.objectUrl();
    String objectDescription = context.objectDescription();
    String objectDisplayName = context.objectDisplayName();
    if (objectUrl != null || objectDescription != null || objectDisplayName != null) {
        result.add(new ObjectMetadataAction(objectDisplayName, objectDescription, objectUrl));
    }
    return result;
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:23,代码来源:ASFGitSCMNavigator.java

示例8: retrieveActions

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@NonNull
@Override
protected List<Action> retrieveActions(SCMSourceEvent event, @NonNull TaskListener listener)
        throws IOException, InterruptedException {
    if (giteaRepository == null) {
        try (GiteaConnection c = gitea().open()) {
            listener.getLogger().format("Looking up repository %s/%s%n", repoOwner, repository);
            giteaRepository = c.fetchRepository(repoOwner, repository);
        }
    }
    List<Action> result = new ArrayList<>();
    result.add(new ObjectMetadataAction(null, giteaRepository.getDescription(), giteaRepository.getWebsite()));
    result.add(new GiteaLink("icon-gitea-repo", UriTemplate.buildFromTemplate(serverUrl)
            .path(UriTemplateBuilder.var("owner"))
            .path(UriTemplateBuilder.var("repository"))
            .build()
            .set("owner", repoOwner)
            .set("repository", repository)
            .expand()
    ));
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:23,代码来源:GiteaSCMSource.java

示例9: supports

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean supports(@NonNull String remote) {
    if (DISABLE) {
        LOGGER.log(disabled ? Level.FINE : Level.WARNING,
                "{0} functionality has been disabled using the {0}.DISABLE kill switch",
                ASFGitSCMFileSystem.class);
        disabled = DISABLE;
        return false;
    } else {
        if (disabled) {
            LOGGER.log(Level.INFO,
                    "{0} functionality has been re-enabled by turning off the {0}.DISABLE kill switch",
                    ASFGitSCMFileSystem.class);
            disabled = false;
        }
    }
    for (String prefix : GIT_WEB_HOSTS) {
        if (remote.startsWith(prefix + "/")) {
            return true;
        }
    }
    return false;
}
 
开发者ID:stephenc,项目名称:asf-gitpubsub-jenkins-plugin,代码行数:27,代码来源:ASFGitSCMFileSystem.java

示例10: build

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@NonNull
@Override
public GiteaSCMSource build() {
    GiteaSCMSource result = new GiteaSCMSource(serverUrl, repoOwner, projectName());
    result.setId(id());
    result.setCredentialsId(credentialsId());
    result.setTraits(traits());
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:10,代码来源:GiteaSCMSourceBuilder.java

示例11: canOpen

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@Override
public boolean canOpen(@NonNull Gitea gitea) {
    synchronized (mocks) {
        return mocks.containsKey(gitea.serverUrl());

    }
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:8,代码来源:MockGiteaConnectionFactory.java

示例12: afterSave

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@Override
public void afterSave(@NonNull SCMNavigatorOwner owner) {
    WebhookRegistration mode = new GiteaSCMSourceContext(null, SCMHeadObserver.none())
            .withTraits(new GiteaSCMNavigatorContext().withTraits(traits).traits())
            .webhookRegistration();
    GiteaWebhookListener.register(owner, this, mode, credentialsId);
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:8,代码来源:GiteaSCMNavigator.java

示例13: typeOf

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * Determines the type of a push event.
 *
 * @param event the event.
 * @return the type.
 */
@NonNull
private static Type typeOf(@NonNull GiteaPushEvent event) {
    if (StringUtils.isBlank(event.getBefore())
            || "0000000000000000000000000000000000000000".equals(event.getBefore())) {
        return Type.CREATED;
    }
    if (StringUtils.isBlank(event.getAfter())
            || "0000000000000000000000000000000000000000".equals(event.getAfter())) {
        return Type.REMOVED;
    }
    return Type.UPDATED;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:19,代码来源:GiteaPushSCMEvent.java

示例14: createCategories

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
@NonNull
@Override
protected SCMHeadCategory[] createCategories() {
    return new SCMHeadCategory[]{
            new UncategorizedSCMHeadCategory(Messages._GiteaSCMSource_UncategorizedCategory()),
            new ChangeRequestSCMHeadCategory(Messages._GiteaSCMSource_ChangeRequestCategory())
            // TODO add support for tags and maybe feature branch identification
    };
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:10,代码来源:GiteaSCMSource.java

示例15: doFillStrategyIdItems

import edu.umd.cs.findbugs.annotations.NonNull; //导入依赖的package包/类
/**
 * Populates the strategy options.
 *
 * @return the stategy options.
 */
@NonNull
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused") // stapler
public ListBoxModel doFillStrategyIdItems() {
    ListBoxModel result = new ListBoxModel();
    result.add(Messages.BranchDiscoveryTrait_excludePRs(), "1");
    result.add(Messages.BranchDiscoveryTrait_onlyPRs(), "2");
    result.add(Messages.BranchDiscoveryTrait_allBranches(), "3");
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:16,代码来源:BranchDiscoveryTrait.java


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