dev@jax-ws.java.net

Re: Method names of XMLStreamBuffer

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 10 Mar 2006 09:46:56 +0100

Kohsuke Kawaguchi wrote:
> Paul Sandoz wrote:
>
>> To keep things consistent with "writing to" and "reading from" or
>> "pushing" and "pulling" perhaps the following would be better:
>>
>> StreamReaderBufferProcessor readFromXMLStreamReader()
>
>
> I'm not sure about this name, actually. If you just look at it, it
> almost looks like the method is so that somehow you can fill an
> XMLStreamBuffer from XMLStreamReader.
>
> I really think "createXMLStreamReader", "newXMLStreamReader", or even
> "getXMLStreamReader" would be better. I think these naming conventions
> are well established.
>

I was trying to take the concept of "you read pages from a book" and
apply it to "you read infoset from a XMLStreamReader" :-)

This is similar concept as the methods on Message e.g.

   readEnvelopeAsSource
   readPayloadAsSource
   readPayloadAsJAXB
   XMLStreamReader readPayload

So may be "readAsXMLStreamReader" would work, and it would also be
consistent with what we have for Message (in addition to providing a
nice balance to the "writeTo" methods)?


>> The reason why XMLStreamBufferMark derives from XMLStreamBuffer is
>> that i did not want any differentiation in terms of processing so that
>> the user or the processors need not know when using a mark or not. But
>> i agree it would be better to clear this up.
>
>
> The changes you made looks good, but if I may add one more thing, we
> should really keep a simple name for user-visible classes, and ugly
> names for XMLStreamBuffer implementation.
>

I agree ugly names are bad.


> So I think it's better to use the name "XMLStreamBufferMark" for the
> current ImmutableXMLStreamBuffer, and then the current
> XMLStreamBufferMark can be called like XMLStreamBufferMarkImpl or
> something --- if Creator offers a method to create a new mark, the user
> code wouldn't have to see XMLStreamBufferMarkImpl.
>

"XMLStreamBufferMark" is defintely a nicer name but the trouble is i
think it misleading as a base class because a (mutable) XMLStreamBuffer
is not really a mark into another buffer.

How about "ReadOnlyXMLStreamBuffer", which would fit with the "readAs"
methods :-)

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109