本文整理汇总了Java中org.apache.tools.ant.taskdefs.Property.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setValue方法的具体用法?Java Property.setValue怎么用?Java Property.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.Property
的用法示例。
在下文中一共展示了Property.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/** Execute this task. */
public void execute () throws BuildException {
if ( values.isEmpty() ) {
throw new BuildException("You must set at least one value!", getLocation());
}
if ( target == null ) {
throw new BuildException("Target must be set!", getLocation());
}
for (String val : values) {
log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
CallTarget antCall = (CallTarget) getProject().createTask("antcall");
antCall.init();
antCall.setLocation(getLocation());
// ant.setDir (dir);
antCall.setTarget (target);
Property prop = antCall.createParam();
prop.setName(name);
prop.setValue(val);
antCall.execute();
}
}
示例2: handlePropertyParameter
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private void handlePropertyParameter() {
if (isRequired() && getProject().getProperty(property) == null) {
throw new BuildException("expected property '" + property + "': " + description);
}
if (!possibleValues.isEmpty()) {
String currentValue = getProject().getProperty(property);
if (!possibleValues.contains(currentValue)) {
throw new BuildException("current value of property '" + property
+ "' doesn't match with possible values : " + possibleValues.toString());
}
}
if (defaultValue != null && getProject().getProperty(property) == null) {
Property propTask = new Property();
propTask.setProject(getProject());
propTask.setTaskName(getTaskName());
propTask.setName(property);
propTask.setValue(defaultValue);
propTask.execute();
}
}
示例3: reinit
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
* Called in execute or createProperty if newProject is null. <p>
*
* This can happen if the same instance of this task is run twice as
* newProject is set to null at the end of execute (to save memory and help
* the GC).</p> <p>
*
* Sets all properties that have been defined as nested property elements.
* </p>
*/
private void reinit() {
init();
final int count = properties.size();
for ( int i = 0; i < count; i++ ) {
Property p = (Property)properties.elementAt( i );
Property newP = (Property)newProject.createTask( "property" );
newP.setName( p.getName() );
if ( p.getValue() != null ) {
newP.setValue( p.getValue() );
}
if ( p.getFile() != null ) {
newP.setFile( p.getFile() );
}
if ( p.getResource() != null ) {
newP.setResource( p.getResource() );
}
if ( p.getPrefix() != null ) {
newP.setPrefix( p.getPrefix() );
}
if ( p.getRefid() != null ) {
newP.setRefid( p.getRefid() );
}
if ( p.getEnvironment() != null ) {
newP.setEnvironment( p.getEnvironment() );
}
if ( p.getClasspath() != null ) {
newP.setClasspath( p.getClasspath() );
}
properties.setElementAt( newP, i );
}
}
示例4: setPropertyValue
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
protected final void setPropertyValue(String value) {
if (value != null) {
if (override) {
if (getProject().getUserProperty(property) == null)
getProject().setProperty(property, value);
else
getProject().setUserProperty(property, value);
} else {
Property p = (Property) project.createTask("property");
p.setName(property);
p.setValue(value);
p.execute();
}
}
}
示例5: reinit
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
* Called in execute or createProperty if newProject is null.
* <p>
*
* This can happen if the same instance of this task is run twice as
* newProject is set to null at the end of execute (to save memory and help
* the GC).
* </p>
* <p>
*
* Sets all properties that have been defined as nested property elements.
* </p>
*/
private void reinit() {
init();
final int count = properties.size();
for (int i = 0; i < count; i++) {
Property p = (Property) properties.elementAt(i);
Property newP = (Property) newProject.createTask("property");
newP.setName(p.getName());
if (p.getValue() != null) {
newP.setValue(p.getValue());
}
if (p.getFile() != null) {
newP.setFile(p.getFile());
}
if (p.getResource() != null) {
newP.setResource(p.getResource());
}
if (p.getPrefix() != null) {
newP.setPrefix(p.getPrefix());
}
if (p.getRefid() != null) {
newP.setRefid(p.getRefid());
}
if (p.getEnvironment() != null) {
newP.setEnvironment(p.getEnvironment());
}
if (p.getClasspath() != null) {
newP.setClasspath(p.getClasspath());
}
properties.setElementAt(newP, i);
}
}
示例6: setResultPropertyValue
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
protected final void setResultPropertyValue(Project project, String value) {
if (value != null) {
if (override) {
if (project.getUserProperty(resultproperty) == null)
project.setProperty(resultproperty, value);
else
project.setUserProperty(resultproperty, value);
} else {
Property p = (Property) project.createTask("property");
p.setName(resultproperty);
p.setValue(value);
p.execute();
}
}
}
示例7: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public boolean execute(Project project, long contentLength, InputStream content) throws Throwable {
Ant ant = (Ant) project.createTask("ant");
File baseDir = project.getBaseDir();
if (dir != null)
baseDir = new File(dir);
ant.setDir(baseDir);
ant.setInheritAll(inheritall);
ant.setInheritRefs(interitrefs);
if (target != null)
ant.setTarget(target);
if (antFile != null)
ant.setAntfile(antFile);
Enumeration e = properties.elements();
PropertyContainer pc = null;
Property p = null;
while (e.hasMoreElements()) {
pc = (PropertyContainer) e.nextElement();
p = ant.createProperty();
p.setName(pc.getName());
p.setValue(pc.getValue());
}
e = references.elements();
ReferenceContainer rc = null;
Ant.Reference ref = null;
while (e.hasMoreElements()) {
rc = (ReferenceContainer) e.nextElement();
ref = new Ant.Reference();
ref.setRefId(rc.getRefId());
ref.setToRefid(rc.getToRefId());
ant.addReference(ref);
}
ant.execute();
return false;
}
示例8: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public boolean execute(Project project, long contentLength, InputStream content) throws Throwable {
CallTarget callTarget = (CallTarget) project.createTask("antcall");
callTarget.setInheritAll(inheritall);
callTarget.setInheritRefs(interitrefs);
String toExecute = target;
if (toExecute == null)
toExecute = project.getDefaultTarget();
callTarget.setTarget(toExecute);
Enumeration e = properties.elements();
PropertyContainer pc = null;
Property p = null;
while (e.hasMoreElements()) {
pc = (PropertyContainer) e.nextElement();
p = callTarget.createParam();
p.setName(pc.getName());
p.setValue(pc.getValue());
}
e = references.elements();
ReferenceContainer rc = null;
Ant.Reference ref = null;
while (e.hasMoreElements()) {
rc = (ReferenceContainer) e.nextElement();
ref = new Ant.Reference();
ref.setRefId(rc.getRefId());
ref.setToRefid(rc.getToRefId());
callTarget.addReference(ref);
}
callTarget.execute();
return false;
}
示例9: deliverDependency
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void deliverDependency(ModuleRevisionId depMrid, String version, String status,
String depStatus) {
if (isNullOrEmpty(deliverTarget)) {
return;
}
// call deliver target if any
CallTarget ct = (CallTarget) getProject().createTask("antcall");
ct.setOwningTarget(getOwningTarget());
ct.init();
ct.setTarget(deliverTarget);
ct.setInheritAll(true);
ct.setInheritRefs(true);
Property param = ct.createParam();
param.setName("dependency.name");
param.setValue(depMrid.getName());
param = ct.createParam();
param.setName("dependency.published.status");
param.setValue(status);
param = ct.createParam();
param.setName("dependency.published.version");
param.setValue(version);
param = ct.createParam();
param.setName("dependency.version");
param.setValue(depMrid.getRevision());
param = ct.createParam();
param.setName("dependency.status");
param.setValue(depStatus == null ? "null" : depStatus);
ct.perform();
String deliveredProperty = depMrid.getName() + "." + depMrid.getRevision()
+ ".delivered";
getProject().setProperty(deliveredProperty, "true");
appendDeliveryList(deliveredProperty + " = true");
getProject().setProperty("recursive." + depMrid.getName() + ".delivered", "true");
appendDeliveryList("recursive." + depMrid.getName() + ".delivered" + " = true");
}
示例10: progress
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void progress(IvyEvent event) {
Project project = (Project) IvyContext.peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY);
if (project == null) {
Message.info("ant call trigger can only be used from an ant build. Ignoring.");
return;
}
if (onlyonce && isTriggered(event)) {
Message.verbose("call already triggered for this event, skipping: " + event);
} else {
CallTarget call = new CallTarget();
call.setProject(project);
call.setTaskName("antcall");
Map<String, String> attributes = event.getAttributes();
String target = IvyPatternHelper.substituteTokens(getTarget(), attributes);
call.setTarget(target);
for (Map.Entry<String, String> entry : attributes.entrySet()) {
Property p = call.createParam();
p.setName(prefix == null ? entry.getKey() : prefix + entry.getKey());
p.setValue(entry.getValue() == null ? "" : entry.getValue());
}
Message.verbose("triggering ant call: target=" + target + " for " + event);
call.execute();
markTriggered(event);
Message.debug("triggered ant call finished: target=" + target + " for " + event);
}
}
示例11: createAntProperty
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private Property createAntProperty( String name, String value )
{
Property property = new Property();
property.setProject( antProject() );
property.setName( name );
property.setValue( value );
property.execute();
return property;
}
示例12: setProperty
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private void setProperty(final String name, final String value) {
final Property property = (Property) getProject().createTask("property");
property.setOwningTarget(getOwningTarget());
property.init();
property.setName(name);
property.setValue(value);
property.execute();
}
示例13: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void execute() {
validate();
final byte[] bytes = readFully();
final String input = new String(bytes);
final String output = performMatching(input);
if (output != null) {
Property p = (Property) getProject().createTask("property");
p.setName(property);
p.setValue(output);
p.execute();
}
}
示例14: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void execute() throws BuildException {
try {
super.execute();
} catch (final BuildException be) {
if (failonerror) throw be;
if (null != failonerrorProperty) {
final Property property = (Property) getProject().createTask("property");
property.setOwningTarget(getOwningTarget());
property.init();
property.setName(failonerrorProperty);
property.setValue("true");
property.execute();
}
}
}
示例15: populate
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private void populate(final Property property)
{
if (nameSet) {
property.setName(name);
}
if (valueSet) {
property.setValue(value);
}
if (locationSet) {
property.setLocation(location);
}
if (fileSet) {
property.setFile(file);
}
if (urlSet) {
property.setUrl(url);
}
if (resourceSet) {
property.setResource(resource);
}
if (classpathAttributeSet) {
property.setClasspath(classpathAttribute);
}
if (classpath != null) {
property.createClasspath().add(classpath);
}
if (classpathRefSet) {
property.setClasspathRef(classpathRef);
}
if (environmentSet) {
property.setEnvironment(environment);
}
if (referenceSet) {
property.setRefid(reference);
}
if (prefixSet) {
property.setPrefix(prefix);
}
}