Class AddressHelper


  • public class AddressHelper
    extends Object
    A Helper to access Address fields
    • Constructor Detail

      • AddressHelper

        public AddressHelper()
    • Method Detail

      • distance

        public static double distance​(double lat1,
                                      double lon1,
                                      double lat2,
                                      double lon2,
                                      DistanceUnit distanceUnit)
        Returns the geo distance between the 2 lat / lon
      • format

        public static String format​(IAddress address)
        Returns the formatted address. Basically, if there's an addressLine1, use it, optionally with addressLine2. Otherwise, if there are street / building number / complement fields, use them. Finally, if neither, return the city name if available.
      • getDTOPropertyForField

        public static Property<String,​AddressDTO> getDTOPropertyForField​(AddressFields field)
        Returns the correspondent property object of an optional address field from the given address
      • getValue

        public static String getValue​(AddressFields field,
                                      IAddress address)
        Returns the value for a given optional field for the given address
      • getVOPropertyForField

        public static Property<String,​AddressVO> getVOPropertyForField​(AddressFields field)
        Returns the correspondent property object of an optional address field from the AddressVO bean.
      • isEquals

        public static boolean isEquals​(IAddress address1,
                                       IAddress address2)
        Returns true if the address1 is equals to address2 by comparing it's fields
      • isLocalizable

        public static boolean isLocalizable​(IAddress address)
        Returns:
        true if the current address has city or zipCode and addressLine1 or street defined
      • isRequired

        public static boolean isRequired​(List<AddressFields> requiredAddressFields,
                                         AddressFields field)
        Returns true if the given address field is included in the given required address fields
      • setValue

        public static void setValue​(AddressFields field,
                                    IAddress address,
                                    String value)
        Sets the value for a given optional field on the given address