FileDocCategorySizeDatePackage
Equals.javaAPI DocApache Ant 1.702452Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.condition

Equals

public class Equals extends Object implements Condition
Simple String comparison condition.
since
Ant 1.4

Fields Summary
private String
arg1
private String
arg2
private boolean
trim
private boolean
caseSensitive
Constructors Summary
Methods Summary
public booleaneval()

return
true if the two strings are equal
exception
BuildException if the attributes are not set correctly

        if (arg1 == null || arg2 == null) {
            throw new BuildException("both arg1 and arg2 are required in "
                                     + "equals");
        }

        if (trim) {
            arg1 = arg1.trim();
            arg2 = arg2.trim();
        }

        return caseSensitive ? arg1.equals(arg2) : arg1.equalsIgnoreCase(arg2);
    
public voidsetArg1(java.lang.String a1)
Set the first string

param
a1 the first string


                  
        
        arg1 = a1;
    
public voidsetArg2(java.lang.String a2)
Set the second string

param
a2 the second string

        arg2 = a2;
    
public voidsetCasesensitive(boolean b)
Should the comparison be case sensitive?

param
b if true use a case sensitive comparison (this is the default)
since
Ant 1.5

        caseSensitive = b;
    
public voidsetTrim(boolean b)
Should we want to trim the arguments before comparing them?

param
b if true trim the arguments
since
Ant 1.5

        trim = b;