FileDocCategorySizeDatePackage
DotnetDefine.javaAPI DocApache Ant 1.703094Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.optional.dotnet

DotnetDefine

public class DotnetDefine extends Object
definitions can be conditional. What .NET conditions can not be is in any state other than defined and undefined; you cannot give a definition a value.

Fields Summary
private String
name
private String
ifCond
private String
unlessCond
Constructors Summary
Methods Summary
public java.lang.StringgetName()
Get the name of the definition.

return
the name.

        return name;
    
public java.lang.StringgetValue(org.apache.tools.ant.Task owner)
This method gets the value of this definition. Will be null if a condition was declared and not met

param
owner owning task
return
The value of the definition.
throws
BuildException if there is an error.

        if (name == null) {
            throw new BuildException("No name provided for the define element",
                owner.getLocation());
        }
        if (!isSet(owner)) {
            return null;
        }
        return name;
    
public booleanisSet(org.apache.tools.ant.Task owner)
logic taken from patternset

param
owner the owning task.
return
true if the condition is valid

        Project p = owner.getProject();
        if (ifCond != null && p.getProperty(ifCond) == null) {
            return false;
        } else if (unlessCond != null && p.getProperty(unlessCond) != null) {
            return false;
        }
        return true;
    
public voidsetIf(java.lang.String condition)
the name of a property which must be defined for the definition to be set. Optional.

param
condition the name of the property

        this.ifCond = condition;
    
public voidsetName(java.lang.String name)
the name of the definition. Required.

param
name the name value.

        this.name = name;
    
public voidsetUnless(java.lang.String condition)
the name of a property which must be undefined for the definition to be set. Optional.

param
condition the name of the property

        this.unlessCond = condition;