> I tried to do a factory method, but I couldn't with enum, 
> since it's impossible to initialize an Enum Type:
> 
>     
> public static AcaoEnum factory() {
>     return new AcaoEnum();
> }
> 
> that's not possible to do. ANd now, How can I binding an enum 
> type? please, anyone can help me?

As I described in my previous posting, you most reasonable
customization point in this case is the "deserializer" attribute 
of the value element. It's quite simple:

<value name=.. set-method=..
deserializer="YourClass.fromString"
get-method=.../>

where

class YourClass {
      ...

        public static AcaoEnum fromString(String val) {
          if (val == null || val.length() == 0) {
             ...// handle optional values
          } else {
             AcaoEnum.valueOf(AcaoEnum.class, val); //[1]
          }
        }

}

[1] works only, if the xml contains strings that correspond to
the enumaerator names. If they do not (e.g. if you want to map
your enum-constructor strings with enum values), you have to
prepare a corresponding Map<String, AcaoEnum> from which you
map any feasible input string onto your enum values.

HTH,

Daniel Krügler

 
Bruker Daltonik GmbH
------------------------------
Fahrenheitstrasse 4
28359 Bremen, Germany
 
Permoserstrasse 15
04318 Leipzig, Germany
 
Geschäftsführer: Frank Laukien, Ph. D., Gerd Hülso, Sebastian Meyer-Plath, 
Stefan Ruge, Ian Sanders, Ph. D., Dr. Michael Schubert
 
Sitz der Gesellschaft: Bremen
 
Handelsregister Amtsgericht Bremen: HRB 8150
 
www.bdal.de
------------------------------------------------------------
Haftungsausschluss: Die Bruker Daltonik GmbH ist nicht verantwortlich für die 
ordnungsgemäße, vollständige und verzögerungsfreie Übertragung der Nachricht. 
Der Inhalt der E-Mail ist nur rechtsverbindlich, wenn er unsererseits durch 
einen Brief oder ein Fax entsprechend bestätigt wird.
Exclusion from liability: Any liability of Bruker Daltonik GmbH referring to 
the correct, complete and immediate transmission of the message shall be 
excluded. The content of the e-mail including its attachments is only legally 
binding if confirmed by Bruker Daltonik GmbH by letter or fax.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to