Create Empty tag in Jaxb2


jaxb.properties
javax.xml.bind.context.factory = org.eclipse.persistence.jaxb.JAXBContextFactory



package com.infodart.central.integration.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
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.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.persistence.oxm.annotations.XmlMarshalNullRepresentation;
import org.eclipse.persistence.oxm.annotations.XmlNullPolicy;
import com.infodart.central.integration.demo.util.Constants;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "WHDEO")
@XmlType(propOrder = { "state", "currencyCode", "email", "country", "orgUnitId", "warehouseId", "warehouseName", "address1", "address2", "city", "pincode", "phoneNumber"})
@Entity
@Table(name = Constants.TABLE_EBS_WAREHOUSE)
public class EbsWarehouse implements java.io.Serializable {
private static final long serialVersionUID = -7520690623726202333L;
@XmlTransient
@Id
@Column(name = "ID")
private String id;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "Wh")
@Column(name = "WAREHOUSE_ID")
private String warehouseId;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "OrgUnitId")
@Column(name = "ORG_UNIT_ID")
private String orgUnitId;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "WhName")
@Column(name = "WAREHOUSE_NAME")
private String warehouseName;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "CurrencyCode")
@Column(name = "CURRENCY_CODE")
private String currencyCode;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "CountryId")
@Column(name = "COUNTRY")
private String country;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "State")
@Column(name = "STATE")
private String state;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "WhCity", required=true, nillable = true)
@Column(name = "CITY")
private String city;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "WhAdd1")
@Column(name = "ADDRESS1")
private String address1;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "WhAdd2")
@Column(name = "ADDRESS2")
private String address2;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "WhPcode")
@Column(name = "PINCODE")
private String pincode;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name = "PhoneNum")
@Column(name = "PHONE_NUMBER")
private String phoneNumber;
@XmlNullPolicy(emptyNodeRepresentsNull=true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
@XmlElement(name="Email")
@Column(name = "EMAIL")
private String email;
@XmlTransient
@Column(name = "MESSAGE_TYPE")
private String messageType;
@XmlTransient
@Column(name = "STATUS")
private String status;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(String warehouseId) {
this.warehouseId = warehouseId;
}
public String getOrgUnitId() {
return orgUnitId;
}
public void setOrgUnitId(String orgUnitId) {
this.orgUnitId = orgUnitId;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getPincode() {
return pincode;
}
public void setPincode(String pincode) {
this.pincode = pincode;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public EbsWarehouse() {
}
public EbsWarehouse(String id, String warehouseId, String orgUnitId, String warehouseName, String currencyCode, String country, String state, String city, String address1, String address2,
String pincode, String phoneNumber, String email, String messageType, String status) {
super();
this.id = id;
this.warehouseId = warehouseId;
this.orgUnitId = orgUnitId;
this.warehouseName = warehouseName;
this.currencyCode = currencyCode;
this.country = country;
this.state = state;
this.city = city;
this.address1 = address1;
this.address2 = address2;
this.pincode = pincode;
this.phoneNumber = phoneNumber;
this.email = email;
this.messageType = messageType;
this.status = status;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("EbsWarehouse [");
if (id != null)
builder.append("id=").append(id).append(", ");
if (warehouseId != null)
builder.append("warehouseId=").append(warehouseId).append(", ");
if (orgUnitId != null)
builder.append("orgUnitId=").append(orgUnitId).append(", ");
if (warehouseName != null)
builder.append("warehouseName=").append(warehouseName).append(", ");
if (currencyCode != null)
builder.append("currencyCode=").append(currencyCode).append(", ");
if (country != null)
builder.append("country=").append(country).append(", ");
if (state != null)
builder.append("state=").append(state).append(", ");
if (city != null)
builder.append("city=").append(city).append(", ");
if (address1 != null)
builder.append("address1=").append(address1).append(", ");
if (address2 != null)
builder.append("address2=").append(address2).append(", ");
if (pincode != null)
builder.append("pincode=").append(pincode).append(", ");
if (phoneNumber != null)
builder.append("phoneNumber=").append(phoneNumber).append(", ");
if (email != null)
builder.append("email=").append(email).append(", ");
if (messageType != null)
builder.append("messageType=").append(messageType).append(", ");
if (status != null)
builder.append("status=").append(status);
builder.append("]");
return builder.toString();
}
}

Comments

Popular posts from this blog

Conversion from Clob To String in java and Vice versa

Portable Java 8/ JDK8 setup without admin rights

Multi Threading , Producer consumer problem in Java