0

The xmlattribute is always returning true, I need the default value set to false.

Here is the code i'm using:

@XmlAttribute(name = "returnInterest", required=false)
protected Boolean returnInterest;

public boolean isReturnInterest() {

    if (returnInterest == null) {
        return false;
    } 
    else {
        return false;
    }
}

/**
 * Sets the value of the returnInterest property.
 * 
 * @param value
 *  allowed object is
 *  {@link Boolean }
 *     
 */
 public void setReturnInterest(Boolean value) {
     this.returnInterest = value;
 }
Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85
  • In your title, you say XMLAttribute is always returning true, in your explanation false. Which one is it? – Kurt Van den Branden Jul 06 '16 at 16:28
  • You must at least tag the code language you're using and ask a more detailed question. I know it's Java but most people don't and you should give more details about the technology you're using. – Fernando Silveira Jul 06 '16 at 18:47

1 Answers1

0

Please try with this code

protected Boolean returnInterest=false;

@XmlAttribute(name = "returnInterest", required=false)
public boolean isReturnInterest() {
    return returnInterest;
}

public void setReturnInterest(Boolean value) {
    this.returnInterest = value;
}