users@jaxb.java.net

Re: Is java.util.Map supported in JAXB 2.0

From: slrosh <snrpriyadarshana_at_yahoo.com>
Date: Mon, 27 Apr 2009 20:41:37 -0700 (PDT)

 Hi

I have a existing class and I want to expose this class as a web service....

public interface IHierarchyFacade()
{
       Hierarchy addHierarchy(Hierarchy hierarchy );
}

::Hierarchy class::

public class Hierarchy implements Serializable {

/** The Constant serialVersionUID. */
        private static final long serialVersionUID = 8061706495012574352L;

        /** The hierarchy id. */
        private Long hierarchyId;

        /** The hierarchy name. */
        private String hierarchyName;
        .........
        .........
        /** The hierarchy nodes. */
        private Set<HierarchyNode> hierarchyNodes;

}

HierarchyNode is also a class::

public class HierarchyNode implements Serializable {
       
      /** The hierarchy id. */
        private Long hierarchyId;
        
        /** The node id. */
        private Long nodeId;
        
        /** The parent node id. */
        private Long parentNodeId;

        ....................
        ....................
        ....................
       /** The hierarchy nodes. */
        private Set<HierarchyNode> hierarchyNodes;

}


This is the structure of the project....

I think JAXB not suported to java collection like java.util.Set






Wolfgang Laun-2 wrote:
>
> Be more specific. Do you want to customize a schema, or do you want to do
> this by annotations to existing Java classes? What's the type of the
> Set<?>
> element? What XML representation do you have?
> -W
>
> On Fri, Apr 24, 2009 at 12:43 PM, slrosh <snrpriyadarshana_at_yahoo.com>
> wrote:
>
>>
>>
>> Hi... I am new to JAXB... I want to know how to write a wrapper class for
>> java.util.Set collection...
>>
>>
>>
>> Felipe Gaucho wrote:
>> >
>> > XML Schema does not support Maps :(
>> >
>> > you must create your own wrapper to represent a Map as XML data
>> >
>> > On Mon, Mar 31, 2008 at 2:41 AM, raags <apparna_at_gmail.com> wrote:
>> >>
>> >> Hi, I'm new to JAXB and I noticed a problem when I deployed a web
>> >> service
>> >> which had a method that returned a Map. JAXB threw an error stating
>> that
>> >> Map
>> >> is an interface, and JAXB does not support interfaces.
>> >> @WebMethod
>> >> public Map<String, String> findAllXYZ(HashMap map)
>> >> {
>> >> return map;
>> >> }
>> >>
>> >> JAXB spec states this..
>> >> 8.5.4 Collections
>> >> The following collection must be supported:
>> >> java.util.Map and its subtypes (e.g. java.util.HashMap)
>> >> java.util.Collection and it's subtypes (e.g. java.util.List)
>> >>
>> >> Can someone throw any light on this issue please?
>> >>
>> >> Thanks,
>> >> Raags
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Is-java.util.Map-supported-in-JAXB-2.0-tp16389809p16389809.html
>> >> Sent from the java.net - jaxb users mailing list archive at
>> Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> >> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-java.util.Map-supported-in-JAXB-2.0-tp16389809p23213785.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>

-- 
View this message in context: http://www.nabble.com/Is-java.util.Map-supported-in-JAXB-2.0-tp16389809p23269607.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.