Menu

#7 MessageBuilder#build() returns Packet

open
nobody
None
6
2001-03-25
2001-03-24
Neil Conway
No

MessageBuilder#build() is declared to return a Packet,
but (AFAICT), it should return a Message. All this
method really does is create a Message from the current
MessageBuilder -- I don't think there is a reason to
declare that it returns the superclass. By returning a
Packet, we need to explicitely cast the returned Packet
back into a Message before we can use
MessengerBean#send() -- which seems to be pointless and
clumsy, IMHO.

Is this a mistake, or am I just clueless?

This is with JabberBeans 0.9.0-pre3

Discussion

  • David Waite

    David Waite - 2001-03-25

    Logged In: YES
    user_id=9752

    the issue is that build is declared in the superclass as
    abstract, and this feature is used to allow the packet
    handler interface (PacketSubHandler) to be used in the sax
    handler code in an abstract manner.

    There could be a special purpose build function just for
    this use (buildPacket), which sub-classes implement by just
    having it call their own non-inheirited build() routine.

    Thoughts?

    In the meantime - this is operating as intended, but there
    might be a much better way for it to work. I'll move this to
    feature requests for discussion.

     
  • David Waite

    David Waite - 2001-03-25
    • priority: 5 --> 6
     

Log in to post a comment.