cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remco (JIRA)" <>
Subject [jira] [Commented] (CXF-5997) Generating isX method instead of getX method for java.lang.Boolean
Date Thu, 11 Sep 2014 11:26:34 GMT


Remco commented on CXF-5997:

According to the javabeans spec, the isX method is ONLY allowed to be used for basic boolean
types, NOT the java.lang.Boolean object.

So I expect cxf to generate a getX method for java.lang.Boolean objects instead of an isX
method. But still generate an isX method for basic boolean types.

Frameworks which use the java.beans.PropertyDescriptor to retrieve the readMethod will be
unable to get the methods since the PropertyDescriptor expects a getX method for java.lang.Boolean

Code snippet from dozer which throws an Exception:

  protected Method getReadMethod() throws NoSuchMethodException {
    Method result = getPropertyDescriptor(srcDeepIndexHintContainer).getReadMethod();
    if (result == null) {
      throw new NoSuchMethodException("Unable to determine read method for Field: " + fieldName
+ " in Class: " + clazz);
    return result;

private PropertyDescriptor getPropertyDescriptor(HintContainer deepIndexHintContainer) {
    if (pd == null) {
      pd = ReflectionUtils.findPropertyDescriptor(clazz, fieldName, deepIndexHintContainer);
      if (pd == null) {
        MappingUtils.throwMappingException("Property: " + fieldName + " not found in Class:
" + clazz);
    return pd;

Copied from the spec
(notice the usage of a boolean with lower case b instead of a Boolean):

Boolean properties
In addition, for boolean properties, we allow a getter method to match the pattern:
public boolean is<PropertyName>();
This “is<PropertyName>” method may be provided instead of a “get<PropertyName>”
method, or it may be provided in addition to a “get<PropertyName>” method.
In either case, if the “is<PropertyName>” method is present for a boolean property
then we will use the “is<PropertyName>” method to read the property value.
An example boolean property might be: public boolean isMarsupial(); public void setMarsupial(boolean

> Generating isX method instead of getX method for java.lang.Boolean
> ------------------------------------------------------------------
>                 Key: CXF-5997
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 3.0.1
>         Environment: Maven, cxf-codegen-plugin
>            Reporter: Remco
>            Assignee: Freeman Fang
>            Priority: Minor
> We use the cxf maven plugin to generate ws code from a set of wsdl's.
> But we run into an issue with cxf, it generates isX methods instead of getX methods for
java.lang.Boolean types. This is not in accordance with the javabeans spec. According to the
java spec it is only allowed to use isX methods for the basic boolean type.
> Other frameworks which try to retrieve the readmethods using the java.beans.PropertyDescriptor
throw a NoSuchMethodException on the read method for this field since it expects a getX method
instead of an isX method.
> After googling a bit I found this plugin:
> But this plugin also generates getX methods for the basic boolean type, which will also
not work with frameworks using the PropertyDescriptor since it then expects an isX method.

This message was sent by Atlassian JIRA

View raw message