hudson.Util.isOverridden()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(229)

本文整理了Java中hudson.Util.isOverridden()方法的一些代码示例,展示了Util.isOverridden()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isOverridden()方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:isOverridden

Util.isOverridden介绍

[英]Checks if the method defined on the base type with the given arguments is overridden in the given derived type.
[中]检查在具有给定参数的基类型上定义的方法是否在给定的派生类型中被重写。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public void postCheckout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener) throws IOException, InterruptedException {
  3. if (Util.isOverridden(SCM.class, getClass(), "postCheckout", Run.class, Launcher.class, FilePath.class, TaskListener.class)) {
  4. postCheckout((Run) build, launcher, workspace, listener);
  5. }
  6. /* Default implementation is noop */
  7. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public void onLoad(AbstractBuild<?,?> build) {
  3. if (Util.isOverridden(Cause.class, getClass(), "onLoad", Run.class)) {
  4. onLoad((Run) build);
  5. }
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Can the {@link #restart()} method restart Hudson?
  3. *
  4. * @throws RestartNotSupportedException
  5. * If the restart is not supported, throw this exception and explain the cause.
  6. */
  7. public void verifyRestartable() throws RestartNotSupportedException {
  8. // the rewriteHudsonWar method isn't overridden.
  9. if (!Util.isOverridden(Lifecycle.class,getClass(), "restart"))
  10. throw new RestartNotSupportedException("Restart is not supported in this running mode (" +
  11. getClass().getName() + ").");
  12. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public boolean isApplicable(AbstractProject project) {
  3. if (Util.isOverridden(SCMDescriptor.class, getClass(), "isApplicable", Job.class)) {
  4. return isApplicable((Job) project);
  5. } else {
  6. return true;
  7. }
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated since 1.382
  3. * Use/override {@link #getModuleRoot(FilePath, AbstractBuild)} instead.
  4. */
  5. @Deprecated
  6. public FilePath getModuleRoot(FilePath workspace) {
  7. if (Util.isOverridden(SCM.class,getClass(),"getModuleRoot", FilePath.class,AbstractBuild.class))
  8. // if the subtype already implements newer getModuleRoot(FilePath,AbstractBuild), call that.
  9. return getModuleRoot(workspace,null);
  10. return workspace;
  11. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public void onAddedTo(AbstractBuild build) {
  3. if (Util.isOverridden(Cause.class, getClass(), "onAddedTo", Run.class)) {
  4. onAddedTo((Run) build);
  5. }
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public boolean processWorkspaceBeforeDeletion(AbstractProject<?,?> project, FilePath workspace, Node node) throws IOException, InterruptedException {
  3. if (Util.isOverridden(SCM.class, getClass(), "processWorkspaceBeforeDeletion", Job.class, FilePath.class, Node.class)) {
  4. return processWorkspaceBeforeDeletion((Job) project, workspace, node);
  5. } else {
  6. return true;
  7. }
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated in favor of {@link #buildEnvironment(Run, Map)}.
  3. */
  4. @Deprecated
  5. public void buildEnvVars(AbstractBuild<?,?> build, Map<String, String> env) {
  6. if (Util.isOverridden(SCM.class, getClass(), "buildEnvironment", Run.class, Map.class)) {
  7. buildEnvironment(build, env);
  8. }
  9. // default implementation is noop.
  10. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Called by {@link Run} to allow plugins to contribute environment variables.
  3. *
  4. * @param run
  5. * The calling build. Never null.
  6. * @param env
  7. * Environment variables should be added to this map.
  8. * @since 2.76
  9. */
  10. default void buildEnvironment(@Nonnull Run<?, ?> run, @Nonnull EnvVars env) {
  11. if (run instanceof AbstractBuild
  12. && Util.isOverridden(EnvironmentContributingAction.class,
  13. getClass(), "buildEnvVars", AbstractBuild.class, EnvVars.class)) {
  14. buildEnvVars((AbstractBuild) run, env);
  15. }
  16. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Called on the start of each build, giving extensions a chance to intercept
  3. * the data that is written to the log.
  4. *
  5. * @deprecated as of 1.632. Use {@link #decorateLogger(Run, OutputStream)}
  6. */
  7. public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException {
  8. if (Util.isOverridden(ConsoleLogFilter.class, getClass(), "decorateLogger", Run.class, OutputStream.class)) {
  9. // old client calling newer implementation. forward the call.
  10. return decorateLogger((Run) build, logger);
  11. } else {
  12. // happens only if the subtype fails to override neither decorateLogger method
  13. throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " +
  14. "deprecated decorateLogger(AbstractBuild,OutputStream) method. " +
  15. "Update the plugin to use setUp(Run,OutputStream) instead.");
  16. }
  17. }

代码示例来源:origin: jenkinsci/jenkins

  1. /** @deprecated Use {@link #buildEnvironment(Run, EnvVars)} instead. */
  2. @Deprecated
  3. public void buildEnvVars(AbstractBuild<?,?> build, EnvVars env) {
  4. if (Util.isOverridden(ParameterValue.class, getClass(), "buildEnvironment", Run.class, EnvVars.class)) {
  5. buildEnvironment(build, env);
  6. } else {
  7. // for backward compatibility
  8. buildEnvVars(build,(Map<String,String>)env);
  9. }
  10. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.382.
  3. * Use/derive from {@link #getModuleRoots(FilePath, AbstractBuild)} instead.
  4. */
  5. @Deprecated
  6. public FilePath[] getModuleRoots(FilePath workspace) {
  7. if (Util.isOverridden(SCM.class,getClass(),"getModuleRoots", FilePath.class, AbstractBuild.class))
  8. // if the subtype already derives newer getModuleRoots(FilePath,AbstractBuild), delegate to it
  9. return getModuleRoots(workspace,null);
  10. // otherwise the default implementation
  11. return new FilePath[] { getModuleRoot(workspace), };
  12. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated
  3. * Use {@link #perform(AbstractBuild, Launcher, BuildListener)} instead.
  4. */
  5. @Deprecated
  6. public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener)
  7. throws InterruptedException, IOException {
  8. if (build instanceof AbstractBuild && Util.isOverridden(BuildStepCompatibilityLayer.class, this.getClass(),
  9. "perform", AbstractBuild.class, Launcher.class, BuildListener.class)) {
  10. return perform((AbstractBuild<?, ?>) build, launcher, listener);
  11. }
  12. throw new AbstractMethodError();
  13. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @since 1.568
  3. */
  4. public ChangeLogSet<? extends Entry> parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException {
  5. if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, File.class)) {
  6. return parse((AbstractBuild) build, changelogFile);
  7. } else {
  8. throw new AbstractMethodError("You must override the newer overload of parse");
  9. }
  10. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Deprecated
  2. public void onChangeLogParsed(AbstractBuild<?,?> build, BuildListener listener, ChangeLogSet<?> changelog) throws Exception {
  3. if (Util.isOverridden(SCMListener.class, getClass(), "onChangeLogParsed", Run.class, SCM.class, TaskListener.class, ChangeLogSet.class)) {
  4. onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog);
  5. }
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Called by {@link AbstractBuild} to allow plugins to contribute environment variables.
  3. *
  4. * @deprecated Use {@link #buildEnvironment} instead
  5. *
  6. * @param build
  7. * The calling build. Never null.
  8. * @param env
  9. * Environment variables should be added to this map.
  10. */
  11. @Deprecated
  12. @Restricted(ProtectedExternally.class)
  13. default void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) {
  14. if (Util.isOverridden(EnvironmentContributingAction.class,
  15. getClass(), "buildEnvironment", Run.class, EnvVars.class)) {
  16. buildEnvironment(build, env);
  17. }
  18. }
  19. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Determines the identity in which the {@link hudson.model.Queue.Executable} will run as.
  3. * The default implementation delegates to {@link #authenticate(hudson.model.Queue.Task)}.
  4. * @param item
  5. * The contextual information to assist the authentication.
  6. * The primary interest is likely {@link hudson.model.Queue.Item#task}, which is often {@link AbstractProject}.
  7. * {@link Action}s associated with the item is also likely of interest, such as {@link CauseAction}.
  8. *
  9. * @return
  10. * returning non-null will determine the identity. If null is returned, the next
  11. * configured {@link QueueItemAuthenticator} will be given a chance to authenticate
  12. * the executor. If everything fails, fall back to {@link Task#getDefaultAuthentication()}.
  13. */
  14. public @CheckForNull Authentication authenticate(Queue.Item item) {
  15. if (Util.isOverridden(QueueItemAuthenticator.class, getClass(), "authenticate", Queue.Task.class)) {
  16. return authenticate(item.task);
  17. } else {
  18. throw new AbstractMethodError("you must override at least one of the QueueItemAuthenticator.authenticate methods");
  19. }
  20. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Determines the identity in which the {@link hudson.model.Queue.Executable} will run as.
  3. * The default implementation delegates to {@link #authenticate(hudson.model.Queue.Item)} (there will be no associated actions).
  4. * @param task
  5. * Often {@link AbstractProject}.
  6. *
  7. * @return
  8. * returning non-null will determine the identity. If null is returned, the next
  9. * configured {@link QueueItemAuthenticator} will be given a chance to authenticate
  10. * the executor. If everything fails, fall back to {@link Task#getDefaultAuthentication()}.
  11. * @since 1.560
  12. */
  13. public @CheckForNull Authentication authenticate(Queue.Task task) {
  14. if (Util.isOverridden(QueueItemAuthenticator.class, getClass(), "authenticate", Queue.Item.class)) {
  15. // Need a fake (unscheduled) item. All the other calls assume a BuildableItem but probably it does not matter.
  16. return authenticate(new Queue.WaitingItem(Calendar.getInstance(), task, Collections.<Action>emptyList()));
  17. } else {
  18. throw new AbstractMethodError("you must override at least one of the QueueItemAuthenticator.authenticate methods");
  19. }
  20. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Equivalent to {@code disconnect(null)}
  3. *
  4. * @deprecated as of 1.320.
  5. * Use {@link #disconnect(OfflineCause)} and specify the cause.
  6. */
  7. @Deprecated
  8. public Future<?> disconnect() {
  9. recordTermination();
  10. if (Util.isOverridden(Computer.class,getClass(),"disconnect",OfflineCause.class))
  11. // if the subtype already derives disconnect(OfflineCause), delegate to it
  12. return disconnect(null);
  13. connectTime=0;
  14. return Futures.precomputed(null);
  15. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Disconnect this computer.
  3. *
  4. * If this is the master, no-op. This method may return immediately
  5. * while the launch operation happens asynchronously.
  6. *
  7. * @param cause
  8. * Object that identifies the reason the node was disconnected.
  9. *
  10. * @return
  11. * {@link Future} to track the asynchronous disconnect operation.
  12. * @see #connect(boolean)
  13. * @since 1.320
  14. */
  15. public Future<?> disconnect(OfflineCause cause) {
  16. recordTermination();
  17. offlineCause = cause;
  18. if (Util.isOverridden(Computer.class,getClass(),"disconnect"))
  19. return disconnect(); // legacy subtypes that extend disconnect().
  20. connectTime=0;
  21. return Futures.precomputed(null);
  22. }

相关文章