Type checking always sucks in this context. I also would try to minimize it as much as
possible.
Provided your suggested change still allows to parse existing mapping documents I
don't see why we should
not make our code easier to write.
--Hardy
On Jul 10, 2012, at 10:35 AM, Strong Liu wrote:
current <query-element> is defined as :
<xs:complexType name="query-element" mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="query-param"
type="query-param-element"/>
</xs:sequence>
<xs:attribute name="cache-mode"
type="cache-mode-attribute"/>
<xs:attribute name="cache-region" type="xs:string"/>
<xs:attribute name="cacheable" default="false"
type="xs:boolean"/>
<xs:attribute name="comment" type="xs:string"/>
<xs:attribute name="fetch-size" type="xs:int"/>
<xs:attribute name="flush-mode"
type="flush-mode-attribute"/>
<xs:attribute name="name" use="required"
type="xs:string"/>
<xs:attribute name="read-only" type="xs:boolean"/>
<xs:attribute name="timeout" type="xs:int"/>
</xs:complexType>
then the generated org.hibernate.internal.jaxb.mapping.hbm.JaxbQueryElement has a
_getContent()_ method for both String/Text and query-param attribute
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link JaxbQueryParamElement }{@code >}
* {@link String }
not very happy with this, it would be lot better to have a getQueryParam() and getValue()
so we don't need to check the instance type and do the cast everytime.