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

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

本文整理了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

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

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

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

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

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

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

@Deprecated
public boolean isApplicable(AbstractProject project) {
  if (Util.isOverridden(SCMDescriptor.class, getClass(), "isApplicable", Job.class)) {
    return isApplicable((Job) project);
  } else {
    return true;
  }
}

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

/**
 * @deprecated since 1.382
 *      Use/override {@link #getModuleRoot(FilePath, AbstractBuild)} instead.
 */
@Deprecated
public FilePath getModuleRoot(FilePath workspace) {
  if (Util.isOverridden(SCM.class,getClass(),"getModuleRoot", FilePath.class,AbstractBuild.class))
    // if the subtype already implements newer getModuleRoot(FilePath,AbstractBuild), call that.
    return getModuleRoot(workspace,null);
  return workspace;
}

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

@Deprecated
public void onAddedTo(AbstractBuild build) {
  if (Util.isOverridden(Cause.class, getClass(), "onAddedTo", Run.class)) {
    onAddedTo((Run) build);
  }
}

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

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

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

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

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

/**
 * Called by {@link Run} to allow plugins to contribute environment variables.
 *
 * @param run
 *      The calling build. Never null.
 * @param env
 *      Environment variables should be added to this map.
 * @since 2.76
 */
default void buildEnvironment(@Nonnull Run<?, ?> run, @Nonnull EnvVars env) {
  if (run instanceof AbstractBuild
      && Util.isOverridden(EnvironmentContributingAction.class,
                 getClass(), "buildEnvVars", AbstractBuild.class, EnvVars.class)) {
    buildEnvVars((AbstractBuild) run, env);
  }
}

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

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

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

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

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

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

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

/**
 * @deprecated
 *      Use {@link #perform(AbstractBuild, Launcher, BuildListener)} instead.
 */
@Deprecated
public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener)
    throws InterruptedException, IOException {       
  if (build instanceof AbstractBuild && Util.isOverridden(BuildStepCompatibilityLayer.class, this.getClass(),
      "perform", AbstractBuild.class, Launcher.class, BuildListener.class)) {
    return perform((AbstractBuild<?, ?>) build, launcher, listener);
  }
  throw new AbstractMethodError();
}

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

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

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

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

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

/**
   * Called by {@link AbstractBuild} to allow plugins to contribute environment variables.
   *
   * @deprecated Use {@link #buildEnvironment} instead
   *
   * @param build
   *      The calling build. Never null.
   * @param env
   *      Environment variables should be added to this map.
   */
  @Deprecated
  @Restricted(ProtectedExternally.class)
  default void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) {
    if (Util.isOverridden(EnvironmentContributingAction.class,
               getClass(), "buildEnvironment", Run.class, EnvVars.class)) {
      buildEnvironment(build, env);
    }
  }
}

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

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

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

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

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

/**
 * Equivalent to {@code disconnect(null)}
 *
 * @deprecated as of 1.320.
 *      Use {@link #disconnect(OfflineCause)} and specify the cause.
 */
@Deprecated
public Future<?> disconnect() {
  recordTermination();
  if (Util.isOverridden(Computer.class,getClass(),"disconnect",OfflineCause.class))
    // if the subtype already derives disconnect(OfflineCause), delegate to it
    return disconnect(null);
  connectTime=0;
  return Futures.precomputed(null);
}

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

/**
 * Disconnect this computer.
 *
 * If this is the master, no-op. This method may return immediately
 * while the launch operation happens asynchronously.
 *
 * @param cause
 *      Object that identifies the reason the node was disconnected.
 *
 * @return
 *      {@link Future} to track the asynchronous disconnect operation.
 * @see #connect(boolean)
 * @since 1.320
 */
public Future<?> disconnect(OfflineCause cause) {
  recordTermination();
  offlineCause = cause;
  if (Util.isOverridden(Computer.class,getClass(),"disconnect"))
    return disconnect();    // legacy subtypes that extend disconnect().
  connectTime=0;
  return Futures.precomputed(null);
}

相关文章