Saturday, February 26, 2011

Bug: Boolean Accessors Prefixed with "is" not recognized as attribute in JDeveloper 11.1.1.4

The biggest fail that I noticed in JDeveloper 11.1.1.4.0 (aka Patch Set 3) is the inability to recognized boolean properties that are prefixed with "is" like isActive() as property in the entity xml files. My disappointment is that- this is properly recognized in earlier releases. We wanted to jive with the most recent release, so we have a lot of refactoring to make.
Below is a sample entity class and the corresponding entity xml file that was generated by JDev:
package model;

public class Employee {
    private Long id;
    private Boolean active;
    private String firstName;
    private String lastName;

    public void setActive(Boolean active) {
        this.active = active;
    }

    public Boolean isActive() {
        return active;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getLastName() {
        return lastName;
    }
}
Generated xml:
<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="11.1.1.59.23"
          id="Employee" Package="model" BeanClass="model.Employee"
          isJavaBased="true">
  <Attribute Name="id" Type="java.lang.Long"/>
  <Attribute Name="firstName" Type="java.lang.String"/>
  <Attribute Name="lastName" Type="java.lang.String"/>
  <MethodAccessor IsCollection="false" Type="void" id="setActive"
                  ReturnNodeName="Return">
    <ParameterInfo id="active" Type="java.lang.Boolean" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="java.lang.Boolean" id="isActive"
                  ReturnNodeName="Return"/>
  <ConstructorMethod IsCollection="true" Type="model.Employee"
                     BeanClass="model.Employee" id="Employee"/>
</JavaBean>
Notice that isActive() is not part of the attributes.

2 comments:

  1. Hi,

    did you create a Service Request by Oracle for this bug?

    ReplyDelete
  2. Reported as internal bug:
    Bug 10193085 - BEAN DATA CONTROL CREATION FAILS FOR BOOLEAN ACCESSORS

    ReplyDelete