javax.annotation.CheckForNull Java Examples
The following examples show how to use
javax.annotation.CheckForNull.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: grpc-nebula-java Author: grpc-nebula File: ServiceConfigInterceptor.java License: Apache License 2.0 | 6 votes |
@CheckForNull private MethodInfo getMethodInfo(MethodDescriptor<?, ?> method) { Map<String, MethodInfo> localServiceMethodMap = serviceMethodMap.get(); MethodInfo info = null; if (localServiceMethodMap != null) { info = localServiceMethodMap.get(method.getFullMethodName()); } if (info == null) { Map<String, MethodInfo> localServiceMap = serviceMap.get(); if (localServiceMap != null) { info = localServiceMap.get( MethodDescriptor.extractFullServiceName(method.getFullMethodName())); } } return info; }
Example #2
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: SourceActions.java License: GNU General Public License v2.0 | 6 votes |
@Nonnull private List<Action> retrieve(@Nonnull SCMRevisionImpl revision, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException { List<Action> actions = new ArrayList<>(); String hash = revision.getHash(); Action linkAction = GitLabLinkAction.toCommit(source.getProject(), hash); actions.add(linkAction); SCMHead head = revision.getHead(); if (head instanceof GitLabSCMMergeRequestHead) { actions.add(createHeadMetadataAction(head.getName(), ((GitLabSCMMergeRequestHead) head).getSource(), hash, linkAction.getUrlName())); } else if (head instanceof GitLabSCMHead) { actions.add(createHeadMetadataAction(head.getName(), (GitLabSCMHead) head, hash, linkAction.getUrlName())); } if (event instanceof GitLabSCMEvent) { actions.add(new GitLabSCMCauseAction(((GitLabSCMEvent) event).getCause())); } return actions; }
Example #3
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: NoneBranchBuildStrategyImpl.java License: MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener taskListener) { if(strategies.isEmpty()){ return false; } for (BranchBuildStrategy strategy: strategies) { if(strategy.automaticBuild( source, head, currRevision, lastBuiltRevision, lastSeenRevision, taskListener )){ return false; }; } return true; }
Example #4
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: AnyBranchBuildStrategyImpl.java License: MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener taskListener) { if(strategies.isEmpty()){ return false; } for (BranchBuildStrategy strategy: strategies) { if(strategy.automaticBuild( source, head, currRevision, lastBuiltRevision, lastSeenRevision, taskListener )){ return true; }; } return false; }
Example #5
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: AllBranchBuildStrategyImpl.java License: MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener taskListener) { if(strategies.isEmpty()){ return false; } for (BranchBuildStrategy strategy: strategies) { if(!strategy.automaticBuild( source, head, currRevision, lastBuiltRevision, lastSeenRevision, taskListener )){ return false; }; } return true; }
Example #6
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: SourceHeads.java License: GNU General Public License v2.0 | 5 votes |
private void retrieveTags(@CheckForNull SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (source.getSourceSettings().getTagMonitorStrategy().getMonitored()) { log(listener, Messages.GitLabSCMSource_retrievingTags()); for (GitlabTag tag : api().getTags(source.getProjectId())) { checkInterrupt(); observe(criteria, observer, tag, listener); } } }
Example #7
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: GitLabLinkAction.java License: GNU General Public License v2.0 | 5 votes |
@Nonnull public static GitLabLinkAction create(@CheckForNull String displayName, @Nonnull String iconFileName, @Nonnull String url) { if (displayName == null) { return create("", iconFileName, url); } return new GitLabLinkAction(displayName, iconFileName, url); }
Example #8
Source Project: simple-pull-request-job-plugin Author: jenkinsci File: PipelineGenerator.java License: Apache License 2.0 | 5 votes |
@CheckForNull public static <T extends PipelineGenerator> T lookupConverter(Class<T> clazz) { for (PipelineGenerator gen : all()) { if (clazz.equals(gen.getClass())) { return clazz.cast(gen); } } return null; }
Example #9
Source Project: simple-pull-request-job-plugin Author: jenkinsci File: PipelineGenerator.java License: Apache License 2.0 | 5 votes |
@Nonnull public static List<String> convert(@Nonnull String converterName, @CheckForNull Object object) throws ConversionException { PipelineGenerator gen = lookupForName(converterName); if (gen == null) { // TODO: add better diagnostics (field matching) throw new ConversionException("Cannot find converter for the type: " + converterName); } //TODO: handle raw type conversion risks return gen.toPipeline(object); }
Example #10
Source Project: simple-pull-request-job-plugin Author: jenkinsci File: CustomSectionGenerator.java License: Apache License 2.0 | 5 votes |
@Nonnull @Override public List<String> toPipeline(@CheckForNull CustomPipelineSection section) throws ConversionException { if (section == null) { return Collections.emptyList(); } PipelineGenerator gen = PipelineGenerator.lookupForName(section.getName()); if (gen == null) { throw new ConversionException("No converter for Custom Pipeline Section: " + section.getName()); } return gen.toPipeline(section.getData()); }
Example #11
Source Project: simple-pull-request-job-plugin Author: jenkinsci File: CustomSectionGeneratorTest.java License: Apache License 2.0 | 5 votes |
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") @Nonnull @Override public List<String> toPipeline(@CheckForNull Object object) throws ConversionException { if (object == null) { throw new ConversionException("No data"); } HashMap<String, String> data = (HashMap<String, String>)object; return Collections.singletonList("foo('" + data.get("field1") +"','" + data.get("field2") + "')"); }
Example #12
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: NoneBranchBuildStrategyImpl.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Deprecated @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision prevRevision) { return isAutomaticBuild(source, head, currRevision, prevRevision, new LogTaskListener(Logger.getLogger(getClass().getName()), Level.INFO)); }
Example #13
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: NoneBranchBuildStrategyImpl.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Deprecated @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision prevRevision, @NonNull TaskListener taskListener) { return isAutomaticBuild(source,head, currRevision, prevRevision, prevRevision, taskListener); }
Example #14
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: SkipInitialBuildOnFirstBranchIndexing.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener taskListener) { if (lastSeenRevision != null) { return true; } return false; }
Example #15
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: SourceHeads.java License: GNU General Public License v2.0 | 5 votes |
private void retrieveBranches(@CheckForNull SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, @Nonnull TaskListener listener) throws InterruptedException, IOException { if (source.getSourceSettings().getBranchMonitorStrategy().getMonitored()) { log(listener, Messages.GitLabSCMSource_retrievingBranches()); for (GitlabBranch branch : api().getBranches(source.getProjectId())) { checkInterrupt(); if (!source.isExcluded(branch.getName())) { observe(criteria, observer, branch, listener); } } } }
Example #16
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: BranchBuildStrategyImpl.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Deprecated @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision prevRevision, @NonNull TaskListener taskListener) { return isAutomaticBuild(source,head, currRevision, prevRevision, prevRevision, taskListener); }
Example #17
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: BranchBuildStrategyImpl.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener taskListener) { if (head instanceof ChangeRequestSCMHead) { return false; } if (head instanceof TagSCMHead) { return false; } return true; }
Example #18
Source Project: basic-branch-build-strategies-plugin Author: jenkinsci File: AnyBranchBuildStrategyImpl.java License: MIT License | 5 votes |
/** * {@inheritDoc} */ @Deprecated @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision prevRevision, @NonNull TaskListener taskListener) { return isAutomaticBuild(source,head, currRevision, prevRevision, prevRevision, taskListener); }
Example #19
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: SourceActions.java License: GNU General Public License v2.0 | 5 votes |
@Nonnull List<Action> retrieve(@Nonnull SCMHead head, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (head instanceof GitLabSCMHead) { return retrieve((GitLabSCMHead) head, event, listener); } return emptyList(); }
Example #20
Source Project: gerrit-code-review-plugin Author: jenkinsci File: GerritSCMSource.java License: Apache License 2.0 | 5 votes |
@Restricted(DoNotUse.class) @DataBoundSetter public void setExtensions(@CheckForNull List<GitSCMExtension> extensions) { List<SCMSourceTrait> traits = new ArrayList<>(this.traits); for (Iterator<SCMSourceTrait> iterator = traits.iterator(); iterator.hasNext(); ) { if (iterator.next() instanceof GitSCMExtensionTrait) { iterator.remove(); } } EXTENSIONS: for (GitSCMExtension extension : Util.fixNull(extensions)) { for (SCMSourceTraitDescriptor d : SCMSourceTrait.all()) { if (d instanceof GitSCMExtensionTraitDescriptor) { GitSCMExtensionTraitDescriptor descriptor = (GitSCMExtensionTraitDescriptor) d; if (descriptor.getExtensionClass().isInstance(extension)) { try { SCMSourceTrait trait = descriptor.convertToTrait(extension); if (trait != null) { traits.add(trait); continue EXTENSIONS; } } catch (UnsupportedOperationException e) { LOGGER.log( Level.WARNING, "Could not convert " + extension.getClass().getName() + " to a trait", e); } } } LOGGER.log( Level.FINE, "Could not convert {0} to a trait (likely because this option does not " + "make sense for a GitSCMSource)", extension.getClass().getName()); } } setTraits(traits); }
Example #21
Source Project: remoting-kafka-plugin Author: jenkinsci File: GlobalKafkaConfiguration.java License: MIT License | 5 votes |
@CheckForNull private StandardUsernamePasswordCredentials getCredential(@Nonnull String id) { StandardUsernamePasswordCredentials credential = null; List<StandardUsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.get(), ACL.SYSTEM, Collections.emptyList()); IdMatcher matcher = new IdMatcher(id); for (StandardUsernamePasswordCredentials c : credentials) { if (matcher.matches(c)) { credential = c; } } return credential; }
Example #22
Source Project: remoting-kafka-plugin Author: jenkinsci File: KubernetesFactoryAdapter.java License: MIT License | 5 votes |
public KubernetesFactoryAdapter(String serviceAddress, String namespace, @CheckForNull String caCertData, @CheckForNull String credentials, boolean skipTlsVerify, int connectTimeout, int readTimeout, int maxRequestsPerHost) { this.serviceAddress = serviceAddress; this.namespace = namespace; this.caCertData = caCertData; this.credentials = credentials != null ? getCredentials(credentials) : null; this.skipTlsVerify = skipTlsVerify; this.connectTimeout = connectTimeout; this.readTimeout = readTimeout; this.maxRequestsPerHost = maxRequestsPerHost; }
Example #23
Source Project: remoting-kafka-plugin Author: jenkinsci File: KafkaKubernetesCloud.java License: MIT License | 5 votes |
public Set<String> getNodesInProvisioning(@CheckForNull Label label) { if (label == null) return Collections.emptySet(); return label.getNodes().stream() .filter(KafkaCloudSlave.class::isInstance) .filter(node -> { Computer computer = node.toComputer(); return computer != null && !computer.isOnline(); }) .map(Node::getNodeName) .collect(Collectors.toSet()); }
Example #24
Source Project: gitlab-branch-source-plugin Author: Argelbargel File: SourceActions.java License: GNU General Public License v2.0 | 5 votes |
@Nonnull List<Action> retrieve(@Nonnull SCMRevision revision, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (revision instanceof SCMRevisionImpl) { return retrieve((SCMRevisionImpl) revision, event, listener); } return emptyList(); }
Example #25
Source Project: btree4j Author: myui File: BTree.java License: Apache License 2.0 | 5 votes |
private final BTreeNode createBTreeNode(BTreeRootInfo root, byte status, @CheckForNull BTreeNode parent) throws BTreeException { if (parent == null) { throw new IllegalArgumentException(); } Page p = getFreePage(); BTreeNode node = new BTreeNode(root, p, parent); //node.set(new Value[0], new long[0]); node.ph.setStatus(status); synchronized (_cache) { _cache.put(p.getPageNum(), node); } return node; }
Example #26
Source Project: configuration-as-code-plugin Author: jenkinsci File: SecretSourceResolver.java License: MIT License | 5 votes |
/** * Encodes String so that it can be safely represented in the YAML after export. * @param toEncode String to encode * @return Encoded string * @since 1.25 */ public static String encode(@CheckForNull String toEncode) { if (toEncode == null) { return null; } return toEncode.replace("${", "^${"); }
Example #27
Source Project: micrometer Author: micrometer-metrics File: GuavaCacheMetricsCompatibilityKit.java License: Apache License 2.0 | 5 votes |
@CheckForNull @Override public String load(@Nonnull String key) throws Exception { String val = loadValue.getAndSet(null); if (val == null) throw new Exception("don't load this key"); return val; }
Example #28
Source Project: github-autostatus-plugin Author: jenkinsci File: GithubBuildStatusGraphListener.java License: MIT License | 5 votes |
private static @CheckForNull BuildStatusAction buildStatusActionFor(FlowExecution exec) { BuildStatusAction buildStatusAction = null; Run<?, ?> run = runFor(exec); if (run != null) { buildStatusAction = run.getAction(BuildStatusAction.class); } return buildStatusAction; }
Example #29
Source Project: github-autostatus-plugin Author: jenkinsci File: GithubBuildStatusGraphListener.java License: MIT License | 5 votes |
/** * Gets the jenkins run object of the specified executing workflow. * * @param exec execution of a workflow * @return jenkins run object of a job */ private static @CheckForNull Run<?, ?> runFor(FlowExecution exec) { Queue.Executable executable; try { executable = exec.getOwner().getExecutable(); } catch (IOException x) { getLogger().log(Level.WARNING, null, x); return null; } if (executable instanceof Run) { return (Run<?, ?>) executable; } else { return null; } }
Example #30
Source Project: github-autostatus-plugin Author: jenkinsci File: InfluxDbNotifierConfig.java License: MIT License | 5 votes |
/** * Returns the credentials for calling InfluxDB if they are configured. * * @return the credentials; null if not provided. */ @CheckForNull public UsernamePasswordCredentials getCredentials() { return !StringUtils.isEmpty(influxDbCredentialsId) ? BuildStatusConfig.getCredentials(UsernamePasswordCredentials.class, influxDbCredentialsId) : null; }