[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    Re: [jibx-users] handling pre-Java 5 enumerated types
From:       "James Abley" <james.abley () gmail ! com>
Date:       2006-08-03 8:19:53
Message-ID: 23fce8e60608030119r9dcc213n23c75d772493c238 () mail ! gmail ! com
[Download RAW message or body]

<delayed-response>

Hi Dennis,

Thanks for the response. I figured out the deserializer solution, as
suggested. I'd never appreciated that part of using Commons Lang Enum
before, but that pretty much did all the work for me.

Cheers,

James

</delayed-response>

On 10/05/06, Dennis Sosnoski <dms@sosnoski.com> wrote:
> Hi James,
>
> You can use a simple deserializer for this (either on the <value>
> element, or define a <format> if you're going to be reusing the type).
> The deserializer just needs to be a static method that takes the value
> and returns the instance object; most enumeration patterns include this
> method as part of the class. Most enumeration patterns also have the
> instance object return the value as the toString() result, and as long
> as that's the case you don't even need to specify a serializer.
>
>   - Dennis
>
> Dennis M. Sosnoski
> SOA, Web Services, and XML
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117
>
>
>
> James Abley wrote:
>
> > Hi,
> >
> > I have a schema that contains something like this:
> >
> > <xs:element name="proxy-parameter">
> >    <xs:complexType>
> >      <xs:sequence>
> >        <xs:element name="name" type="xs:string">
> >          <xs:annotation>
> >            <xs:documentation>The name of this
> > parameter</xs:documentation>
> >          </xs:annotation>
> >        </xs:element>
> >        <xs:element name="type" type="ParameterType">
> >          <xs:annotation>
> >            <xs:documentation>The type of this
> > parameter</xs:documentation>
> >          </xs:annotation>
> >        </xs:element>
> >      </xs:sequence>
> >    </xs:complexType>
> > </xs:element>
> >
> > <xs:simpleType name="ParameterType">
> >    <xs:restriction base="xs:string">
> >      <xs:enumeration value="request-parameter"/>
> >      <xs:enumeration value="request-header"/>
> >      <xs:enumeration value="cookie"/>
> >    </xs:restriction>
> >
> >
> > I need to marshal and unmarshal the xml and objects. I wanted to have
> > an enumerated object as per Effective Java's description. I've
> > searched the mailing list archives and tutorial, but haven't been able
> > to find anything that talks about enumerated type support.
> >
> > What are the suggested ways of going about this? I think I need a
> > custom marshaller, but wanted to confirm that I'm on the right lines.
> >
> > Cheers,
> >
> > James
> >
> >
> > -------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > http://sel.as-us.falkag.net/sel?cmd_______________________________________________
> >
> > jibx-users mailing list
> > jibx-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jibx-users
> >
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic