You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Mark Roder <mr...@wamnet.com> on 2002/01/04 22:05:21 UTC

Issue - BeanSererializer encoding a property with only a readMeth od

The BeanSerializer is encoding properties that only have read methods but
not write methods.

I have a bean that contains a indexed property that is implimented using an
ArrayList instead of a array.  I have the full spectrum of the methods for
the indexed propery, but only a getList method for the ArrayList.

The multiple AssetRepresentation elements are getting encoded properly, but
then it encodes the List property.  This is fine in my application because
the axis is not used to process this on the server side, but if it was, then
axis would not be able to read this.


Here is the output I am seeing.
  <AssetRepresentationList>
    <AssetRepresentation>
     <AssetLocator>WG0000005940</AssetLocator>
     <DateCreated xsi:nil="true"/>
    </AssetRepresentation>
    <AssetRepresentation>
     <AssetLocator>WG0000005940</AssetLocator>
     <DateCreated xsi:nil="true"/>
    </AssetRepresentation>
    <List>
     <item>
      <AssetLocator>WG0000005940</AssetLocator>
      <DateCreated xsi:nil="true"/>
     </item>
     <item>
      <AssetLocator>WG0000005940</AssetLocator>
      <DateCreated xsi:nil="true"/>
     </item>
    </List>


Here is the object:

public class AssetRepresentationList extends AbstractValueObject
  {
  private List _assetRepresentations = new ArrayList();




  public void addAssetRepresentation(AssetRepresentation
assetRepresentation)
    {
    _assetRepresentations.add(assetRepresentation);
    }

  public List getList()
    {
    return _assetRepresentations;
    }



  //Indexed Bean Property for axis
  public void setAssetRepresentation(AssetRepresentation[] v)
    {
    _assetRepresentations = Arrays.asList(v);
    }


  public AssetRepresentation[] getAssetRepresentation()
    {
    return (AssetRepresentation[]) _assetRepresentations.toArray();
    }

  public void setAssetRepresentation(int i, AssetRepresentation v)
    {
    _assetRepresentations.add(i,v);
    }

  public AssetRepresentation  getAssetRepresentation(int i)
    {
    return (AssetRepresentation) _assetRepresentations.get(i);
    }


  }

Later

Mark