You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Gregoire Diboula <gr...@gmx.net> on 2004/12/18 11:44:35 UTC

Add and Remove Methods

Hi *,

I am playing around with JaxMe. Everything seems perfect up to now. I 
just want to ask if JaxMe supports
generating  add and remove methods for elements with multiple occurrences.

Let us take the following example:

<xsd:complexType name="Invitations">
    <xsd:sequence>
        <xsd:element name="Invitation" type="Invitation" minOccurs="0" 
maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>

JaxMe will generate the following interface (and of course its 
implementation):

public interface Invitations {     public java.util.List getInvitation();}

My question is if it is possible to also generate add and remove 
methods. This would result in sth like:

public interface Invitations {
    public java.util.List getInvitation();
    public java.util.List addInvitation(Invitation c);
    public java.util.List removeInvitation(Invitation c);
}

The implementation would be sth like:

public interface InvitationsImpl {
    public java.util.List getInvitation(){ return invitation;}
    public java.util.List addInvitation(Invitation c){ invitation.add(c);
    public java.util.List removeInvitation(Invitation c){ 
invitation.remove(c)};
}


If it is not possible to generate said methods, could you give me some 
hint (which classes should I check)
in extending JaxMe to do this? If on the other hand it is possible to 
generate these methods, what is the procedure
for that?


Thanks for JaxMe and thanks for any reply concerning this posting.

best,

Gregoire


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: Add and Remove Methods

Posted by Jochen Wiedmann <jo...@gmail.com>.
On Sat, 18 Dec 2004 11:44:35 +0100, Gregoire Diboula
<gr...@gmx.net> wrote:

> I am playing around with JaxMe. Everything seems perfect up to now. I
> just want to ask if JaxMe supports
> generating  add and remove methods for elements with multiple occurrences.

It currently does not. However, this would be a comparatively easy
task. Here's what needs to be done:

- Create an instance of JAXBPropertySGChain. The current class
MultiplePropertySGChain
  can be taken as an example. That class is currently creating the
list support. It does so
  by using another JAXBPropertySGChain internally, which is generating
source for managing
  a single list element.

- In JAXBParticleSG.newPropertySGChain(), replace the original class with your
  implementation. Make everything running.

- Post a patch to this list. As what you want is most probably what
other people would
  like to see (for example myself :-), we'd integrate the patch as an
extension. In other
  words, one would need to set a certain switch within the schema.


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org