i have an enums problem and i can't find an example of how to fix it.  i 
have a very dirty work around that is working but its messy and going to 
cause problems in the future.  where is what i have.

for my enum class

public enum SaleOrigin{
WEB("01", "Web Site Origin"), REGISTER("02", "Cash Register Origin");

    private String value;
    private String desc;
    pubilc SaleOrigin(string 1, string 2){
    value = 1;
    desc = 2;
    }
    toString(){
       return value;
    }

    public static SaleOrigin xmlToEnum(String testval)
    {
        for (SaleOrigin shp : SaleOrigin .values())
        {
            if (shp.value.equals(testval)) { return shp; }
        }
        return null;
    }
}

now, value in my constructor is the value of the field that is sent via 
xml, and few other interfaces.  (so in my xml field i get either an "01" 
or an "02"

now first, i read up on the enum-value-method method but if im reading 
it right, i can not supply a parameter in the method it calls.  so how 
do i put the value thats in the xml into the method to map it to the 
correct enum value?  second, what would the binding look like for this, 
is it something like this:

<value name="SalesOrigin" field="saleOrigin" usage="required" 
enum-value-method="SalesXmlToEnum"/>

does anyone have an example of how this works so i can ditch my very 
dirty approach.

thanks



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to