Overview
The UBL Builder library provides two main address classes:- Address - A comprehensive address class with detailed location information
- PostalAddress - A simplified postal address class focused on mailing addresses
Address Class
Import
Constructor Parameters
An identifier for this address within an agreed scheme of address identifiers
The name of a city, town, or village
The political or administrative division of a country in which this address is located, such as the name of its county, province, or state
The political or administrative division of a country expressed as a code
An array of unstructured address lines
The country in which this address is situated
Methods
addAddressLine()
Adds an address line to the address.setCountry()
Sets the country for the address.setId()
Sets an identifier for the address.Example
PostalAddress Class
Import
Constructor Parameters
The main address line in an address (e.g., “Main Street 1”)
The common name of the city, town or village where the address is located
The identifier for an addressable group of properties according to the relevant postal service (e.g., ZIP code, Post Code)
An additional address line that can be used to give further details supplementing the main line (e.g., “Po Box 351”)
The subdivision of a country (e.g., “Region A”)
Additional unstructured address line
The country in which this address is situated
Usage Examples
The PostalAddress class is more commonly used in invoices and is specifically designed for standard postal addresses. The Address class provides more flexibility with additional fields for complex addressing scenarios.
Exported Aliases
Both classes are exported under multiple semantic aliases:Address Aliases
RegistrationAddressJurisdictionRegionAddressDeliveryAddressDespatchAddress
Address class but provide semantic meaning based on their usage context.
Related Components
- Party - Uses addresses for party locations
- Delivery - Uses addresses for delivery locations
- Country - Represents country information
- AddressLine - Represents individual address lines