Announcement Announcement Module
Collapse
No announcement yet.
Mappipng unaware @Endpoint implementation (JAXB2) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mappipng unaware @Endpoint implementation (JAXB2)

    Hi,

    As it's currently implemented, Endpoint implmentation that uses mapping IS compile-time dependent on the mapping type used.
    In other words, the Endpoint implementation does not share tha beauty of POJO

    Code:
        (at)PayloadRoot(localPart = "LoadImageRequest", namespace = "...")
        public JAXBElement<Image> load(JAXBElement<String> requestElement) throws IOException {
            String name = requestElement.getValue();
            Image response = new Image();
            response.setName(name);
            response.setImage(imageRepository.readImage(name));
            return objectFactory.createLoadImageResponse(response);
        }
    The following code would be much more elegant and less verbose.

    Code:
        (at)PayloadRoot(localPart = "LoadImageRequest", namespace = "...")
        public Image load(String name) throws IOException {
            Image response = new Image();
            response.setName(name);
            response.setImage(imageRepository.readImage(name));
            return response;
        }
    It does not look too difficult to create some kind of wrapper arround JAXB2 mapper or (un)marchaler to support the "mapping-less" endpoint implementations.

    Does it make sence for you? what do you think?

    Thanks
    Vitaliy

  • #2
    Got it

    Hi,

    Sorry for disturbing.. actually the second implementation is already possible, depending on the way we create the XSD

    Thanks

    Comment

    Working...
    X