title: Groovy: How to verify if a JAXB instance has a nested property and value present or not
body: <p>We have the below  XML parsed as JAXB instance</p>
  
  <pre><code>&lt;client&gt;
        &lt;cl_id&gt;111871&lt;/cl_id&gt;
        &lt;cl_lf_id&gt;115124&lt;/cl_lf_id&gt;
        &lt;cl_name&gt;0118&lt;/cl_name&gt;
        &lt;cl_address&gt;
          &lt;address_1&gt;Test Corp&lt;/address_1&gt;
          &lt;address_2&gt;200 GRANVILLE STREET&lt;/address_2&gt;
          &lt;address_3&gt;&lt;/address_3&gt;
          &lt;city&gt;Austin&lt;/city&gt;
          &lt;state_province&gt;TX&lt;/state_province&gt;
          &lt;zip_postal_code&gt;77777&lt;/zip_postal_code&gt;
          &lt;country&gt;USA&lt;/country&gt;
          &lt;phone&gt;111-224-3858&lt;/phone&gt;
          &lt;file_item_nbr&gt;5&lt;/file_item_nbr&gt;
        &lt;/cl_address&gt;
        &lt;file_item_nbr&gt;6&lt;/file_item_nbr&gt;      
  &lt;/client&gt;
  </code></pre>
  
  <p>Below is the XSD for `Client</p>
  
  <pre><code>&lt;xsd:complexType name="client"&gt;
      &lt;xsd:sequence&gt;
          &lt;xsd:element name="cl_id" type="string20" minOccurs="0" maxOccurs="1"/&gt;
          &lt;xsd:element name="cl_lf_id" type="string20" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="cl_name" type="string120" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="cl_address" type="address_info" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="client_contact" type="contact_info" minOccurs="0" maxOccurs="1"/&gt;
          &lt;xsd:element name="cl_tax_id" type="string20" minOccurs="0" maxOccurs="1"/&gt;
          &lt;xsd:element name="file_item_nbr" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/&gt;
          &lt;xsd:element name="extend_header" type="extend_header" minOccurs="0" maxOccurs="1"/&gt;
          &lt;xsd:element name="invoice" type="invoice" minOccurs="1" maxOccurs="unbounded"/&gt;
      &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  </code></pre>
  
  <p>Below are the JAXB Pojos for the above xml</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "client", propOrder = {
      "clId",
      "clLfId",
      "clName",
      "clAddress",
      "clientContact",
      "clTaxId",
      "fileItemNbr",
      "extendHeader",    
  })
  public class Client {
  
      @XmlElement(name = "cl_id")
      protected String clId;
      @XmlElement(name = "cl_lf_id", required = true)
      protected String clLfId;
      @XmlElement(name = "cl_name", required = true)
      protected String clName;
      @XmlElement(name = "cl_address", required = true)
      protected AddressInfo clAddress;
      @XmlElement(name = "client_contact")
      protected ContactInfo clientContact;
      @XmlElement(name = "cl_tax_id")
      protected String clTaxId;
      @XmlElement(name = "file_item_nbr", required = true)
      @XmlSchemaType(name = "nonNegativeInteger")
      protected BigInteger fileItemNbr;
      @XmlElement(name = "extend_header")
      protected ExtendHeader extendHeader;
  }
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "address_info", propOrder = {
      "address1",
      "address2",
      "address3",
      "city",
      "stateProvince",
      "zipPostalCode",
      "country",
      "phone",
      "fax",
      "fileItemNbr"
  })
  public class AddressInfo {
  
      @XmlElement(name = "address_1", required = true)
      protected String address1;
      @XmlElement(name = "address_2")
      protected String address2;
      @XmlElement(name = "address_3")
      protected String address3;
      @XmlElement(required = true)
      protected String city;
      @XmlElement(name = "state_province", required = true)
      protected String stateProvince;
      @XmlElement(name = "zip_postal_code", required = true)
      protected String zipPostalCode;
      @XmlElement(required = true)
      protected String country;
      @XmlElement(required = true)
      protected String phone;
      protected String fax;
      @XmlElement(name = "file_item_nbr", required = true)
      @XmlSchemaType(name = "nonNegativeInteger")
      protected BigInteger fileItemNbr;
  }
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "contact_info", propOrder = {
      "contactLname",
      "contactFname",
      "contactId",
      "contactPhone",
      "contactFax",
      "contactEmail",
      "fileItemNbr"
  })
  public class ContactInfo {
      @XmlElement(name = "contact_lname", required = true)
      protected String contactLname;
      @XmlElement(name = "contact_fname", required = true)
      protected String contactFname;
      @XmlElement(name = "contact_id")
      protected String contactId;
      @XmlElement(name = "contact_phone")
      protected String contactPhone;
      @XmlElement(name = "contact_fax")
      protected String contactFax;
      @XmlElement(name = "contact_email", required = true)
      protected String contactEmail;
      @XmlElement(name = "file_item_nbr", required = true)
      @XmlSchemaType(name = "nonNegativeInteger")
      protected BigInteger fileItemNbr;
  }
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "extend_header", propOrder = {
      "vendor",
      "app",
      "sequence",
      "date",
      "extendData"
  })
  public class ExtendHeader {
  
      @XmlElement(required = true)
      protected String vendor;
      protected String app;
      protected String sequence;
      @XmlSchemaType(name = "date")
      protected XMLGregorianCalendar date;
      @XmlElement(name = "extend_data", required = true)
      protected List&lt;ExtendData&gt; extendData;
      }
  </code></pre>
  
  <p>Can someone help how do I check if the <code>Client</code> instance has a nested property <code>address_1</code> present or not and if its present whether the nested property has a non empty value or not?</p>