title: Null Check's increasing cyclomatic complexity
body: <p>I have an java POJO class as below.</p>
  
  <pre><code> public class EmployeeVo {
          private String firstName;
          private String middleName;
          private String lastName;
          private String suffix;
          private String addressline1;
          private String addressline2;
          private String city;
          private String state;
          private String zipCode;
          private String country;
  
              public String getFirstName() {
              return firstName;
          }
          public void setFirstName(String firstName) {
              this.firstName = firstName;
          }
          public String getMiddleName() {
              return middleName;
          }
          public void setMiddleName(String middleName) {
              this.middleName = middleName;
          }
          public String getLastName() {
              return lastName;
          }
          .// Setters and getters for other fields.
          .
          .
  
          }
  </code></pre>
  
  <p>Is there any way to check all the fields of an object at once for null , rather than checking each field for null?</p>
  
  <p>While retrieving these values from EmployeeVo  object </p>
  
  <pre><code>public static boolean isEmpty(String string){
      if(null==string || string.trim().length()==0){
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>I have to manually null check each field before using it some where .
  As the above Object has more than 10 fields it would obviously increase the Cyclomatic  Complexity for that method.
  Is there any optimal solution for it?</p>
  
  <pre><code>if(CommonUtil.isNotEmpty(employeeVO.getCity())){
              postalAddress.setCity(employeeVO.getCity());
          }
          if(CommonUtil.isNotEmpty(employeeVO.getCity())){
              postalAddress.setState(employeeVO.getState());
          }
          if(CommonUtil.isNotEmpty(employeeVO.getZipCode())){
              postalAddress.setPostalCode(employeeVO.getZipCode());
          }
          if(CommonUtil.isNotEmpty(employeeVO.getCountry())){
              postalAddress.setCountryCode(employeeVO.getCountry());
          }
  </code></pre>
  
  <p><strong>Can we use</strong> </p>
  
  <pre><code>String country=employeeVO.getCountry();
  postalAddress.setCountryCode( (country!=null) ? country: "");
  </code></pre>
  
  <p>Just to reduce the complexity? Is this according to standards?</p>