imdahmd
imdahmd

Reputation: 777

How to set a default value when a field is null in jibx binding?

I would like to set a default constant value to a particular value node in JiBX when the corresponding field value is null. Is this possible and if so, how?

Upvotes: 0

Views: 1811

Answers (1)

frankjl
frankjl

Reputation: 404

You can use the element 'default' ... for example:

<value name="YourElementName" field="fieldName" default="default-value" usage="optional" />

This is only allowed for 'optional' elements.

See the description here: http://jibx.sourceforge.net/details/binding-attributes.html#string

Upvotes: 3

Related Questions