3 Replies Latest reply on May 6, 2009 3:34 PM by Matt Wheeler

    CDK Generated component with property type Object[] creates

    Matt Wheeler Newbie

      I am attempting to generate a component using the CDK. However, if I have a property of type java.lang.Object[], then an invalid import statement is created in the resulting taglib.

      For example, say I have the following property in my component configuration file:

       <property>
       <name>selectedValues</name>
       <classname>java.lang.Object[]</classname>
       <description>A list of the selected values.</description>
       </property>


      The resulting Tag.java class contains the following:

      import java.lang.Object[] ;
      //...
       if (this._selectedValues.isLiteralText()) {
       try {
      
       java.lang.Object[] __selectedValues = (java.lang.Object[]) getFacesContext().
       getApplication().
       getExpressionFactory().
       coerceToType(this._selectedValues.getExpressionString(),
       java.lang.Object[].class);
      
       comp.setSelectedValues(__selectedValues);
       } catch (ELException e) {
       throw new FacesException(e);
       }
       } else {
       component.setValueExpression("selectedValues", this._selectedValues);
       }
      



      This can of course be duplicated with a property of any name, and with type Object[], but in my case, I actually don't even have to define the selectedValues property, as it is part of an extended component. However, since the target of the EL comp.setSelectedValues(Object[]) is Object[], I cannot change the type. Is there any way to get around this, and make the CDK not generate the invalid import (java.lang.Object[])?

      Thanks,

      Matt W.