public static Address createShopifyAddress(UserAddress walletUserAddress){
  if (walletUserAddress == null) {
    throw new NullPointerException("walletUserAddress cannot be null");
  }
  Address address=new Address();
  String[] nameParts=extractFirstAndLastNames(walletUserAddress.getName());
  address.setFirstName(nameParts[FIRST_NAME_PART]);
  address.setLastName(nameParts[LAST_NAME_PART]);
  address.setAddress1(walletUserAddress.getAddress1());
  StringBuilder address2=new StringBuilder();
  if (!TextUtils.isEmpty(walletUserAddress.getAddress2())) {
    address2.append(walletUserAddress.getAddress2());
    address2.append(", ");
  }
  if (!TextUtils.isEmpty(walletUserAddress.getAddress3())) {
    address2.append(walletUserAddress.getAddress3());
    address2.append(", ");
  }
  if (!TextUtils.isEmpty(walletUserAddress.getAddress4())) {
    address2.append(walletUserAddress.getAddress4());
    address2.append(", ");
  }
  if (!TextUtils.isEmpty(walletUserAddress.getAddress5())) {
    address2.append(walletUserAddress.getAddress5());
  }
  address.setAddress2(address2.toString());
  address.setZip(walletUserAddress.getPostalCode());
  address.setCity(walletUserAddress.getLocality());
  address.setCountryCode(walletUserAddress.getCountryCode());
  address.setProvinceCode(walletUserAddress.getAdministrativeArea());
  address.setPhone(walletUserAddress.getPhoneNumber());
  return address;
}

public static Address createShopifyAddress ( UserAddress walletUserAddress ) { if ( walletUserAddress == null ) { throw new NullPointerException ( "walletUserAddress cannot be null" ) ; } Address address = new Address ( ) ; String [ ] nameParts = extractFirstAndLastNames ( walletUserAddress . getName ( ) ) ; address . setFirstName ( nameParts [ FIRST_NAME_PART ] ) ; address . setLastName ( nameParts [ LAST_NAME_PART ] ) ; address . setAddress1 ( walletUserAddress . getAddress1 ( ) ) ; StringBuilder address2 = new StringBuilder ( ) ; if ( ! TextUtils . isEmpty ( walletUserAddress . getAddress2 ( ) ) ) { address2 . append ( walletUserAddress . getAddress2 ( ) ) ; address2 . append ( ", " ) ; } if ( ! TextUtils . isEmpty ( walletUserAddress . getAddress3 ( ) ) ) { address2 . append ( walletUserAddress . getAddress3 ( ) ) ; address2 . append ( ", " ) ; } if ( ! TextUtils . isEmpty ( walletUserAddress . getAddress4 ( ) ) ) { address2 . append ( walletUserAddress . getAddress4 ( ) ) ; address2 . append ( ", " ) ; } if ( ! TextUtils . isEmpty ( walletUserAddress . getAddress5 ( ) ) ) { address2 . append ( walletUserAddress . getAddress5 ( ) ) ; } address . setAddress2 ( address2 . toString ( ) ) ; address . setZip ( walletUserAddress . getPostalCode ( ) ) ; address . setCity ( walletUserAddress . getLocality ( ) ) ; address . setCountryCode ( walletUserAddress . getCountryCode ( ) ) ; address . setProvinceCode ( walletUserAddress . getAdministrativeArea ( ) ) ; address . setPhone ( walletUserAddress . getPhoneNumber ( ) ) ; return address ; }
creates a shopify address from a wallet address
