org.apache.tools.ant.Task.getTaskName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(132)

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

Task.getTaskName介绍

[英]Returns the name to use in logging messages.
[中]返回要在日志消息中使用的名称。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Returns the name to use in logging messages.
 *
 * @return the name to use in logging messages.
 */
public String getTaskName() {
  return !(realThing instanceof Task) ? super.getTaskName()
                    : ((Task) realThing).getTaskName();
}

代码示例来源:origin: org.apache.ant/ant

private static List<Task> findElementInTarget(Target t, String name) {
  return Stream.of(t.getTasks())
    .filter(task -> name.equals(task.getTaskName()))
    .collect(Collectors.toList());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Returns the wrapper used for runtime configuration.
 *
 * @return the wrapper used for runtime configuration. This
 *         method will generate a new wrapper (and cache it)
 *         if one isn't set already.
 */
public RuntimeConfigurable getRuntimeConfigurableWrapper() {
  if (wrapper == null) {
    wrapper = new RuntimeConfigurable(this, getTaskName());
  }
  return wrapper;
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Checks if there are any collected errors and throws a BuildException
 * with all messages if there was one or more.
 * @throws BuildException if one or more errors were registered
 */
public void checkErrors() throws BuildException {
  if (!errors.isEmpty()) {
    StringBuilder sb = new StringBuilder(String.format("Configuration error on <%s>:%n",
        task.getTaskName()));
    for (String msg : errors) {
      sb.append(String.format("- %s%n", msg));
    }
    throw new BuildException(sb.toString(), task.getLocation());
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Logs a message to say that the task has started.
 *
 * @param event
 *            An event with any relevant extra information. Must not be
 *            <code>null</code>.
 */
@Override
public void taskStarted(BuildEvent event) {
  String name = event.getTask().getTaskName();
  Date now = new Date();
  logStart(event, now, name);
  profileData.put(event.getTask(), now);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Logs a message to say that the task has finished.
 *
 * @param event
 *            An event with any relevant extra information. Must not be
 *            <code>null</code>.
 */
@Override
public void taskFinished(BuildEvent event) {
  Date start = profileData.remove(event.getTask());
  String name = event.getTask().getTaskName();
  logFinish(event, start, name);
}

代码示例来源:origin: org.apache.ant/ant

throw new BuildException(String.format(
    "Task [%s] failed after [%d] attempts; giving up.%nError messages:%n%s",
    nestedTask.getTaskName(), retryCount, errorMessages), getLocation());

代码示例来源:origin: org.apache.ant/ant

/**
 * @see org.apache.tools.ant.BuildListener#messageLogged(BuildEvent)
 * {@inheritDoc}.
 */
public void messageLogged(BuildEvent event) {
  log("--- MESSAGE LOGGED", Project.MSG_DEBUG);
  StringBuffer buf = new StringBuffer();
  if (event.getTask() != null) {
    String name = event.getTask().getTaskName();
    if (!emacsMode) {
      String label = "[" + name + "] ";
      int size = DefaultLogger.LEFT_COLUMN_SIZE - label.length();
      for (int i = 0; i < size; i++) {
        buf.append(" ");
      }
      buf.append(label);
    }
  }
  buf.append(event.getMessage());
  log(buf.toString(), event.getPriority());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Fired when a task starts building, this pushes a timed element
 * for the task onto the stack of elements for the current thread,
 * remembering the current time and the name of the task.
 *
 * @param event An event with any relevant extra information.
 *              Will not be <code>null</code>.
 */
@Override
public void taskStarted(BuildEvent event) {
  TimedElement taskElement = new TimedElement();
  taskElement.startTime = System.currentTimeMillis();
  taskElement.element = doc.createElement(TASK_TAG);
  Task task = event.getTask();
  String name = event.getTask().getTaskName();
  if (name == null) {
    name = "";
  }
  taskElement.element.setAttribute(NAME_ATTR, name);
  taskElement.element.setAttribute(LOCATION_ATTR, event.getTask().getLocation().toString());
  tasks.put(task, taskElement);
  getStack().push(taskElement);
}

代码示例来源:origin: org.apache.ant/ant

} else {
  String name = event.getTask().getTaskName();
  String label = "[" + name + "] ";
  int size = LEFT_COLUMN_SIZE - label.length();

代码示例来源:origin: apache/groovy

final String taskName = task.getTaskName();

代码示例来源:origin: apache/groovy

public AntBuilder(final Task parentTask) {
  this(parentTask.getProject(), parentTask.getOwningTarget());
  // define "owning" task as wrapper to avoid having tasks added to the target
  // but it needs to be an UnknownElement and no access is available from
  // task to its original UnknownElement 
  final UnknownElement ue = new UnknownElement(parentTask.getTaskName());
  ue.setProject(parentTask.getProject());
  ue.setTaskType(parentTask.getTaskType());
  ue.setTaskName(parentTask.getTaskName());
  ue.setLocation(parentTask.getLocation());
  ue.setOwningTarget(parentTask.getOwningTarget());
  ue.setRuntimeConfigurableWrapper(parentTask.getRuntimeConfigurableWrapper());
  parentTask.getRuntimeConfigurableWrapper().setProxy(ue);
  antXmlContext.pushWrapper(parentTask.getRuntimeConfigurableWrapper());
}

代码示例来源:origin: org.apache.ant/ant

/**
   * Bind a task to another; use this when configuring a newly created
   * task to do work on behalf of another.
   * Project, OwningTarget, TaskName, Location and Description are all copied
   *
   * Important: this method does not call {@link Task#init()}.
   * If you are creating a task to delegate work to, call {@link Task#init()}
   * to initialize it.
   *
   * @param owner owning target
   * @since Ant1.7
   */
  public final void bindToOwner(Task owner) {
    setProject(owner.getProject());
    setOwningTarget(owner.getOwningTarget());
    setTaskName(owner.getTaskName());
    setDescription(owner.getDescription());
    setLocation(owner.getLocation());
    setTaskType(owner.getTaskType());
  }
}

代码示例来源:origin: maven/maven

public void taskStarted( BuildEvent event )
  {
    this.taskStack.push( event.getTask().getTaskName() );
  }
}

代码示例来源:origin: org.apache.ant/ant-apache-log4j

/**
 * @see BuildListener#taskStarted
 * {@inheritDoc}.
 */
@Override
public void taskStarted(final BuildEvent event) {
  final Task task = event.getTask();
  final Logger log = Logger.getLogger(task.getClass().getName());
  log.info("Task \"" + task.getTaskName() + "\" started.");
}

代码示例来源:origin: com.legsem.legstar/legstar-codegen

/**
 * @see BuildListener#taskStarted
 *      {@inheritDoc}
 */
public void taskStarted(final BuildEvent event) {
  if (_log.isDebugEnabled()) {
    _log.debug("Task \"" + event.getTask().getTaskName()
        + "\" started.");
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

@Override
public boolean containsOccurrence(String identifier) {
  if (!getTask().getTaskName().equals("property")) { //$NON-NLS-1$
    return super.containsOccurrence(identifier);
  }
  if (fValue != null) {
    return fValue.indexOf(identifier) != -1;
  }
  return false;
}

代码示例来源:origin: stackoverflow.com

Intent i=getIntent();
int called_from =i.getIntExtra("called",100)
if (called_from == 100) {
    return;
  }

  if (called == (1)){

      Task t = dbHandler.getTask(1);
      editText.setText(t.getTaskName());
      spinner.setSelection(t.getStartMonth());
      spinner2.setSelection(t.getEndMonth());

  }

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

@Override
protected ImageDescriptor getBaseImageDescriptor() {
  String taskName = getTask().getTaskName();
  if ("taskdef".equalsIgnoreCase(taskName) || "typedef".equalsIgnoreCase(taskName)) { //$NON-NLS-1$//$NON-NLS-2$
    return AntUIImages.getImageDescriptor(IAntUIConstants.IMG_ANT_TASKDEF);
  }
  return AntUIImages.getImageDescriptor(IAntUIConstants.IMG_ANT_MACRODEF);
}

代码示例来源:origin: org.ow2.jonas/bootstrap-ant

/**
 * Configure the given task by setting name, project root, etc.
 * @param srcTask source task
 * @param dstTask destination task
 */
public static void configure(final Task srcTask, final Task dstTask) {
  dstTask.setTaskName(srcTask.getTaskName());
  dstTask.setProject(srcTask.getProject());
}

相关文章