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

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(79)

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

Project.setProjectReference介绍

[英]Set a reference to this Project on the parameterized object. Need to set the project before other set/add elements are called.
[中]在参数化对象上设置对此项目的引用。需要在调用其他set/add元素之前设置项目。

代码示例

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

/**
 * helper method to set the project on an object.
 * the reflection setProject does not work for anonymous/protected/private
 * classes, even if they have public methods.
 */
private void setProjectOnObject(Object obj) {
  if (project == null) {
    return;
  }
  if (obj instanceof BaseFilterReader) {
    ((BaseFilterReader) obj).setProject(project);
    return;
  }
  project.setProjectReference(obj);
}

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

@Override
  public void set(final Project p, final Object parent, final String value)
      throws InvocationTargetException, IllegalAccessException, BuildException {
    try {
      final Object[] args = finalIncludeProject
          ? new Object[] {p, value} : new Object[] {value};
      final Object attribute = finalConstructor.newInstance(args);
      if (p != null) {
        p.setProjectReference(attribute);
      }
      m.invoke(parent, attribute);
    } catch (final InvocationTargetException e) {
      final Throwable cause = e.getCause();
      if (cause instanceof IllegalArgumentException) {
        throw new BuildException("Can't assign value '" + value
                     + "' to attribute " + attrName
                     + ", reason: "
                     + cause.getClass()
                     + " with message '"
                     + cause.getMessage() + "'");
      }
      throw e;
    } catch (final InstantiationException ie) {
      throw new BuildException(ie);
    }
  }
};

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

project.setProjectReference(o);
return o;

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

/**
 * Adds the listeners specified in the command line arguments,
 * along with the default listener, to the specified project.
 *
 * @param project The project to add listeners to.
 *                Must not be <code>null</code>.
 */
protected void addBuildListeners(final Project project) {
  // Add the default listener
  project.addBuildListener(createLogger());
  final int count = listeners.size();
  for (int i = 0; i < count; i++) {
    final String className = listeners.elementAt(i);
    final BuildListener listener =
        ClasspathUtils.newInstance(className,
            Main.class.getClassLoader(), BuildListener.class);
    project.setProjectReference(listener);
    project.addBuildListener(listener);
  }
}

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

/**
 * Creates the InputHandler and adds it to the project.
 *
 * @param project the project instance.
 *
 * @exception BuildException if a specified InputHandler
 *                           implementation could not be loaded.
 */
private void addInputHandler(final Project project) throws BuildException {
  InputHandler handler = null;
  if (inputHandlerClassname == null) {
    handler = new DefaultInputHandler();
  } else {
    handler = ClasspathUtils.newInstance(
        inputHandlerClassname, Main.class.getClassLoader(),
        InputHandler.class);
    project.setProjectReference(handler);
  }
  project.setInputHandler(handler);
}

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

nestedObject = nestedCreator.create(project, parent, nestedObject);
if (project != null) {
  project.setProjectReference(nestedObject);

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

final Object nestedElement = nc.create(project, parent, null);
if (project != null) {
  project.setProjectReference(nestedElement);

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

final Project p = getProject();
if (p != null) {
  p.setProjectReference(dynselector);

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

instance = ClasspathUtils.newInstance(classname, ScriptDef.class.getClassLoader());
getProject().setProjectReference(instance);

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

final Project p = getProject();
if (p != null) {
  p.setProjectReference(m);

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

/**
 * Add a ResourceCollection to the container.
 * @param c the ResourceCollection to add.
 * @throws BuildException on error.
 */
public synchronized void add(ResourceCollection c) throws BuildException {
  if (isReference()) {
    throw noChildrenAllowed();
  }
  if (c == null) {
    return;
  }
  if (Project.getProject(c) == null) {
    Project p = getProject();
    if (p != null) {
      p.setProjectReference(c);
    }
  }
  rc.add(c);
  FailFast.invalidate(this);
  coll = null;
  setChecked(false);
}

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

/**
 * Add a ResourceCollection to the container.
 * @param c the ResourceCollection to add.
 * @throws BuildException on error.
 */
public synchronized void add(ResourceCollection c) throws BuildException {
  if (isReference()) {
    throw noChildrenAllowed();
  }
  if (c == null) {
    return;
  }
  if (rc != null) {
    throw oneNested();
  }
  rc = c;
  if (Project.getProject(rc) == null) {
    Project p = getProject();
    if (p != null) {
      p.setProjectReference(rc);
    }
  }
  setChecked(false);
}

代码示例来源:origin: dita-ot/dita-ot

/**
 * Adds the listeners specified in the command line arguments, along with
 * the default listener, to the specified project.
 *
 * @param project The project to add listeners to. Must not be
 *            <code>null</code>.
 */
@Override
protected void addBuildListeners(final Project project) {
  // Add the default listener
  project.addBuildListener(createLogger());
  final int count = listeners.size();
  for (int i = 0; i < count; i++) {
    final String className = listeners.elementAt(i);
    final BuildListener listener = ClasspathUtils.newInstance(className,
        Main.class.getClassLoader(), BuildListener.class);
    project.setProjectReference(listener);
    project.addBuildListener(listener);
  }
}

代码示例来源:origin: dita-ot/dita-ot

/**
 * Creates the InputHandler and adds it to the project.
 *
 * @param project the project instance.
 *
 * @exception BuildException if a specified InputHandler implementation
 *                could not be loaded.
 */
private void addInputHandler(final Project project) throws BuildException {
  InputHandler handler;
  if (inputHandlerClassname == null) {
    handler = new DefaultInputHandler();
  } else {
    handler = ClasspathUtils.newInstance(inputHandlerClassname, Main.class.getClassLoader(),
        InputHandler.class);
    project.setProjectReference(handler);
  }
  project.setInputHandler(handler);
}

相关文章