Boolean fields with MVEL

When creating a Boolean field on java class it is sometimes preferred to use the isField naming convention instead the usual getter with getField. This allows for cleaner code since it reads better on if statements. However, when using this in combination with MVEL, we have to take make sure we define the return value in way that MVEL will interpret correctly.

As an example, using the following method, when MVEL parses the expression it will fail saying that it cannot find the getMyField.

public Boolean isMyField() {
    return BooleanUtils.toBoolean(myField);
}

But if we instead use <code>boolean</code> for a return value, then MVEL will interpret it correctly.

public boolean isMyField() {
    return BooleanUtils.toBoolean(myField);
}