[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] MOXy: example of XmlIsSetNullPolicy use
|
Hi all,
I plan to use MOXy in Jersey server for marshaling annotated entities with
this features:
a) entities are marshaled from/to XML and JSON
b) null values are represented as <field xsi:nil="true"/>
c) unchanged default field values has not to be marshaled
d) changed field values (even changed to default values) has to be marshaled
e) server is able to identify which fields are changed (i.e. changed during
unmarshaling) for partial updates
I am pretty sure that this is for what MOXy specific annotation
XmlIsSetNullPolicy is, but I didn't found any example. It looks like my
entities have to implement "isSet" method for each field and set the
appropriate flag in setter. Something like that (completely based on MOXy
Javadoc):
public class Entity {
private String field = null; // default value
private boolean changed = false;
public String getField() {
return field;
}
@XmlIsSetNullPolicy( isSetMethodName = "isChanged", xsiNilRepresentsNull =
true)
public String setField(String field) {
this.field = field;
this.changed = true;
}
public boolean isChanged() {
return changed;
}
}
Questions:
1) is MOXy able to satisfy all my specified features?
2) are there any examples for use of XmlIsSetNullPolicy?
3) can I specify null policy in one place for ale fields in entity class (or
classes in package), say by parameterized "isSet" method?
Blaise Doughan?
Thanks,
Martin Schayna
--
View this message in context: http://eclipse.1072660.n5.nabble.com/MOXy-example-of-XmlIsSetNullPolicy-use-tp154296.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.