moxy

Unmarshalling LocalDate/LocalDateTime with MOXy

三世轮回 提交于 2019-12-09 03:58:51
问题 How can I get MOXy to unmarshal JSON into LocalDate and LocalDateTime ? I've got an @GET method which produces a sample instance with three fields of types LocalDate , LocalDateTime and Date , respectively. Hitting that endpoint, I get: { "localDate": "2017-07-11", "localDateTime": "2017-07-11T10:11:10.817", "date": "2017-07-11T10:11:10.817+02:00" } I then POST the above data to my @POST method, which simply returns the data again: { "date": "2017-07-11T10:11:10.817+02:00" } As you can see,

Does MOXy support non-string @XmlID in version 2.6.0?

不打扰是莪最后的温柔 提交于 2019-12-08 19:37:50
问题 According to https://gist.github.com/VineetReynolds/5108580, JAXB Spec requires element annotated with @XmlID to be a String . This hasn't been enforced by MOXy in versions 2.5.x . With version 2.6.0 , however, it seems it's not supported anymore. [Exception [EclipseLink-50016] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.JAXBException Exception Description: Property [id] has an XmlID annotation but its type is not String.]**strong text** Is

eclipselink moxy xpath - selecting all child elements of the current node or all elements in a document with a particular name

情到浓时终转凉″ 提交于 2019-12-08 08:32:39
问题 i have this xpath defined for moxy in a jaxb class @XmlPath("child::*/REG") public List entries; but it won't unmarshal the xml document correctly. the List variable called entries is empty. i've also tried @XmlPath("*/REG") public List entries; i've also tried @XmlPath("//REG") public List entries; without joy but if i do @XmlPath("BANKGIRO/REG") public List entries; it's fine and the list is populated. I haven't looked through the source yet but I'm guessing this type of xpath is not

EclipseLink MOXy: Override rules of binding files

痴心易碎 提交于 2019-12-08 07:51:12
问题 I would, in the scenario below, like the binding of java-type name="SubClass" to be applied to set the text field on SuperClass. However it is not. Is there a problem with overriding the bindingsA.xml? According to the Overriding rules documentation: If the same java-type occurs in multiple files, any values that are set in the later file, will override values from the previous file What do I need to do to make it work? Input: <?xml version="1.0" encoding="UTF-8"?> <a text="A text">B text</a>

Make use of @XmlValue in subclass

若如初见. 提交于 2019-12-08 02:53:26
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 private String aValue; } And the usage: public class Root { @XmlElements({ @XmlElement(class = A.class),

With MOXy and XPath, is it possible to unmarshal two lists of attributes?

大城市里の小女人 提交于 2019-12-08 01:38:40
问题 Note, this is not a duplicate of another question I asked, "With MOXy and XPath, is it possible to unmarshal a list of attributes?" It's similar, but not the same. I've got XML that looks like this: <test> <items> <item type="cookie" brand="oreo">cookie</item> <item type="crackers" brand="ritz">crackers</item> </items> </test> This is similar to the xml in my earlier question except now there are two attributes per item instead of one. In my class: @XmlPath("items/item/@type") @XmlAttribute

com.sun.istack.SAXException2: class java.util.LinkedHashMap nor any of its super class is known to this context

◇◆丶佛笑我妖孽 提交于 2019-12-08 01:08:07
问题 I am sending a POST request create a resource named ContentInstance . Resource: ContentInstance . // // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml

Using Moxy as JAXB Implementation and setting jaxb.properties with more than one POJO package

自作多情 提交于 2019-12-07 20:14:56
问题 I am currently trying to use EclipseLink Moxy as my JAXB implementation. I am trying this, because the default implementation included in the JDK seems to have a hard coded indentation level of eight with UTF-8 encoding. My problem is that it seems that I have to put a jaxb.properties file into every package that contains a JAXB POJO. My JAXB POJOs are generated by xjc, specifically by 'jaxb2-maven-plugin'. The POJOs are generated into numerous packages. Is it somehow possible to set the used

EclipseLink dynamic MOXy accessing enum values

五迷三道 提交于 2019-12-07 16:06:54
问题 I'm using the XSD listed below and a corresponding XML. Everything works well with dynamic MOXy but I haven't any idea how to access the enum type within java. Any suggestions? Thanks for help. <?xml version="1.0" encoding="UTF-8"?> <xs:schema ...> <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="first-name" type="xs:string"/> <xs:element name="last-name" type="xs:string"/> <xs:element name="quadrant" type="myns:compass-direction"/> </xs:sequence> </xs:complexType>

Moxy ignore invalid fields in json

不打扰是莪最后的温柔 提交于 2019-12-07 10:08:15
问题 When I send this request: {"invalidField": "value", "date": "value"} to my rest service: @PUT @Consumes("application/json") public void putJson(Test content) { System.out.println(content.toString()); } I expected to get an exception because: There is no invalidField in my domain model. Date format is not valid. But really I get test object with null values. My dmain model is: public class Test { private String name; private Date date; //getters and setters here } I think this is not a valid