本文整理汇总了Java中org.apache.tools.ant.taskdefs.MacroInstance类的典型用法代码示例。如果您正苦于以下问题:Java MacroInstance类的具体用法?Java MacroInstance怎么用?Java MacroInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MacroInstance类属于org.apache.tools.ant.taskdefs包,在下文中一共展示了MacroInstance类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doWork
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
@Override
public void doWork() throws BuildException
{
MacroInstance instance = getMacroInstance();
if (instance == null)
{
throw new BuildException("There is no macros with '" + macros + "' name in the project");
}
for (NameValueHolder attr : attributes)
{
instance.setDynamicAttribute(attr.getName().toLowerCase(), attr.getValue());
}
instance.perform();
}
开发者ID:irudyak,项目名称:ant-toolkit,代码行数:17,代码来源:RunMacrosTask.java
示例2: execute
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
public void execute() {
validate();
final MacroDef.Attribute attribute = new MacroDef.Attribute();
attribute.setName(property);
macroDef.addConfiguredAttribute(attribute);
final String[] values = list.split(" ");
for (String value : values) {
final MacroInstance i = new MacroInstance();
i.setProject(getProject());
i.setOwningTarget(getOwningTarget());
i.setMacroDef(macroDef);
i.setDynamicAttribute(property, value);
i.execute();
}
}
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:18,代码来源:ForEachTask.java
示例3: doSequentialIteration
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
private void doSequentialIteration(Integer val) {
MacroInstance instance = new MacroInstance();
instance.setProject(getProject());
instance.setOwningTarget(owningTarget);
instance.setMacroDef(macroDef);
instance.setDynamicAttribute(param.toLowerCase(), val.toString());
instance.execute();
}
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:9,代码来源:ForTask.java
示例4: doSequentialIteration
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
private void doSequentialIteration(String val) {
MacroInstance instance = new MacroInstance();
instance.setProject(getProject());
instance.setOwningTarget(getOwningTarget());
instance.setMacroDef(macroDef);
instance.setDynamicAttribute(param.toLowerCase(), val);
if (!parallel) {
instance.execute();
} else {
parallelTasks.addTask(instance);
}
}
开发者ID:cniweb,项目名称:ant-contrib,代码行数:13,代码来源:ForTask.java
示例5: getMacroInstance
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
private MacroInstance getMacroInstance()
{
ComponentHelper helper = ComponentHelper.getComponentHelper(this.getProject());
AntTypeDefinition typeDef = helper.getAntTypeTable().get(macros);
if (typeDef == null)
{
return null;
}
Object obj = typeDef.create(this.getProject());
return obj instanceof MacroInstance ? (MacroInstance)obj : null;
}
开发者ID:irudyak,项目名称:ant-toolkit,代码行数:15,代码来源:RunMacrosTask.java
示例6: maybeJavacInMacro
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
/**
* @param task task to check
* @return not-null if task points to macrodef with javac inside
*/
private static Task maybeJavacInMacro(Task task) {
ComponentHelper componentHelper = ComponentHelper.getComponentHelper(task.getProject());
Class clazz = componentHelper.getComponentClass(task.getTaskType());
if (clazz != MacroInstance.class) {
return null;
}
task.getRuntimeConfigurableWrapper().setProxy(componentHelper.createComponent(task.getTaskType()));
task.maybeConfigure();
MacroInstance instance = (MacroInstance) task.getRuntimeConfigurableWrapper().getProxy();
if (findJavac(instance) != null) {
return task;
}
return null;
}
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:19,代码来源:AntProject.java
示例7: findJavac
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
/**
* @param instance macroinstance object
* @return javac task in given macroinstance
*/
private static Task findJavac(MacroInstance instance) {
for (UnknownElement element : instance.getMacroDef().getNestedTask().getChildren()) {
if ("javac".equals(element.getTaskType())) {
return (Task) element.getRuntimeConfigurableWrapper().getProxy();
}
}
return null;
}
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:13,代码来源:AntProject.java
示例8: execute
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
public void execute() {
validate();
if (conditions.getCondition().eval()) {
final MacroInstance i = new MacroInstance();
i.setProject(getProject());
i.setOwningTarget(getOwningTarget());
i.setMacroDef(macroDef);
i.execute();
}
}
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:12,代码来源:IfTask.java
示例9: executeDelayed
import org.apache.tools.ant.taskdefs.MacroInstance; //导入依赖的package包/类
/**
* Executes the passed <code>hook</code> using the attributes defined.
*
* @param hook
* the hook to be executed
*/
public void executeDelayed(final Hook hook) {
final MacroDef macroDef = new MacroDef() {
public UnknownElement getNestedTask() {
final UnknownElement ret = super.getNestedTask();
// remove all the children added by super
if (ret.getChildren() != null) {
ret.getChildren().clear();
}
// add the nestedSequentials of this
for (final UnknownElement e : hook.getNested()) {
ret.addChild(e);
ret.getWrapper().addChild(e.getWrapper());
}
return ret;
}
};
// this is just called so that the nestedSequential isn't null
macroDef.createSequential();
macroDef.setProject(getProject());
// generate an instance of this definition
final MacroInstance instance = new MacroInstance();
instance.setProject(getProject());
instance.setOwningTarget(getOwningTarget());
instance.setMacroDef(macroDef);
// add the attributes to the macroDef and instance
for (final Attribute attribute : getAttributes()) {
final String name = attribute.getName();
final AttributeValue attrVal = attributeValues.get(name);
// add the attribute
macroDef.addConfiguredAttribute(attribute);
// check if we found one
if (attrVal != null) {
instance.setDynamicAttribute(name.toLowerCase(), attrVal.getValue());
}
}
// execute
instance.execute();
}
开发者ID:pmeisen,项目名称:ant-processenabler,代码行数:55,代码来源:TriggerHooks.java
注:本文中的org.apache.tools.ant.taskdefs.MacroInstance类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论