moxy

How an I get MOXy to just output on one line to save space

自闭症网瘾萝莉.ら 提交于 2020-01-15 19:16:31
问题 To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2.1.12). One difference I've noticed is the formatting of the output that Jersey outputs {"artist-list":{"offset":0,"count":1,"artist":[{"score":"100","type":"Group","id":"4302e264-1cf0-4d1f-aca7-2a6f89e34b36","name":"Farming Incident","sort-name":"Incident, Farming","gender":"male","country":"AF","disambiguation":"the real one","ipi-list":{"ipi":

Moxy not honoring the super class/interface properties

跟風遠走 提交于 2020-01-14 14:12:28
问题 enter code here I have the properties for a Customer spread across two interfaces as shown below. I have the external xml binding defined using the sub interface ICustomer. When I marshall the pojo to xml, it seems like the Moxy is ignoring the super interface's property firstName . Is this a bug or do I need to explicitly specify each of these two interfaces in the xml meta-data? Base interface public interface IBaseCustomer { String getFirstName(); void setFirstName(final String firstName);

Moxy not honoring the super class/interface properties

徘徊边缘 提交于 2020-01-14 14:09:22
问题 enter code here I have the properties for a Customer spread across two interfaces as shown below. I have the external xml binding defined using the sub interface ICustomer. When I marshall the pojo to xml, it seems like the Moxy is ignoring the super interface's property firstName . Is this a bug or do I need to explicitly specify each of these two interfaces in the xml meta-data? Base interface public interface IBaseCustomer { String getFirstName(); void setFirstName(final String firstName);

Make use of @XmlValue in subclass

别来无恙 提交于 2020-01-14 04:37:10
问题 I had this code working fine with EclipseLink 2.5.2, but moving to 2.6.0 breaks the XmlValue annotation: The property or field value cannot be annotated with XmlValue since it is a subclass of another XML-bound class. Base class look like this: public abstract class Baseclass { @XmlAttribute private String baseValue; // ... } One of two subclasses (composite pattern, class B can have a list of BaseClass elements): @XmlRootElement(name = "A") public class A extends BaseClass { @XmlValue

JaxB inheritance marshalling abstract classes

时光毁灭记忆、已成空白 提交于 2020-01-06 15:20:08
问题 I've been searching for the best way to perform the following action using JaxB but I cannot find a way that works. I followed the tutorial here to allow for marshaling and unmarshaling of subclasses. It achieves all that I am looking for, except that in order for the subclasses to be properly marshaled and unmarshaled, they must be wrapped in a class with a specific @XmlRootElement . This doesn't allow you to represent the classes themselves as Xml on their own. I want to have a classes like

XmlPath mapping problems using eclipselink MOXy

别来无恙 提交于 2020-01-05 07:22:16
问题 I don't see why the XmlPath mappings I have made below are coming out as null. Is there something wrong with my syntax? I used similar syntax elsewhere without problem. Thanks for any clues.. John <clip lane="-1" offset="2591065664/720000s" name="Music" duration="22304160/240000s" start="176794/48000s" enabled="0" format="r5"> <adjust-volume amount="1dB"> <param name="amount"> <fadeIn type="easeIn" duration="1220/262144s"/> </param> </adjust-volume> <audio ref="r9" name="VoiceOver-26 - audio"

MOXy XMLCompositeCollectionMapping descriptor is missing

柔情痞子 提交于 2020-01-05 07:01:12
问题 docx4j (which I host) is typically used with the Sun/Oracle JAXB implementation; the classes of interest below were generated using XJC. I thought I'd try EclipseLink MOXy, to see how it went. On context init, I get the following error: ERROR org.docx4j.jaxb.Context .<clinit> line 107 - Cannot initialize context javax.xml.bind.JAXBException: Descriptor Exceptions: --------------------------------------------------------- Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2

Moxy is marshalling unmapped java properties

落爺英雄遲暮 提交于 2020-01-04 07:25:07
问题 I was able to use the XML as external meta-data by following the article here. However, Moxy is marshalling the properties that are neither annotated nor specified in the external XML meta-data. Below is the e.g. How to avoid this behavior? I tried using xml-mapping-metadata-complete="true" but it didn't help. Class with new prefix property added (removed other properties for brevity) public class Customer { private String prefix; public void setPrefix(String prefix) { this.prefix = prefix; }

Specifying the MOXy runtime for multiple Java packages

人盡茶涼 提交于 2020-01-04 04:37:27
问题 Is there a way to specify MOXy as my JAXB implementation, for domain classes spread across multiple Java packages, other than putting jaxb.properties into every single package? 回答1: To specify EclipseLink MOXy as the JAXB provider you need to put a jaxb.properties in one of the packages for your domain objects, that is passed in to bootstrap the JAXBContext. For example if your JAXBContext will be based on the following 2 classes: example.foo.Foo example.bar.Bar example.foo.Foo package

With Eclipselink Moxy How do I map xml content to a name different to value?

岁酱吖の 提交于 2020-01-03 19:37:09
问题 In my Xml I have: <alias-list> <alias sort-name="Afghan">Afghany</alias> </alias-list> The json is output as "aliases" [ { "sort-name" : "Afghan", value : "Afghany" } ] but I want it to be: "aliases" [ { "sort-name" : "Afghan", name : "Afghany" } ] So I know how to use oxml.xml to rename an attribute but in this case there is no attribute so unsure how to proceed. 回答1: There is a property you can set to override the default "value" for MOXy's JSON marshalling. This property is set per context