Interface AddressService
-
- All Known Subinterfaces:
AddressService
- All Known Implementing Classes:
ChineseAddressService
,DefaultAddressService
public interface AddressService
Interface for the address handling.- Since:
- 4.3
- Spring Bean ID:
- addressService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AddressModel
cloneAddress(AddressModel address)
Clones an address and sets a link on the new address to the original address.AddressModel
cloneAddressForOwner(AddressModel address, ItemModel owner)
Clones an address but for the given owner and sets a link on the new address to the original address.AddressModel
createAddressForOwner(ItemModel owner)
Creates a new, not persistedAddressModel
for the given owner.AddressModel
createAddressForUser(UserModel user)
Creates a new, not persistedAddressModel
for the given user.java.util.Collection<AddressModel>
getAddressesForOwner(ItemModel owner)
Gets aCollection
ofaddresses
for the given owner e.g.
-
-
-
Method Detail
-
createAddressForUser
AddressModel createAddressForUser(UserModel user)
Creates a new, not persistedAddressModel
for the given user.- Parameters:
user
- creates an address for thisUserModel
- Returns:
- a new, not persisted
AddressModel
- Throws:
java.lang.IllegalArgumentException
- if the given user isnull
-
createAddressForOwner
AddressModel createAddressForOwner(ItemModel owner)
Creates a new, not persistedAddressModel
for the given owner.- Parameters:
owner
- the owner (can be any item) for the address, as example: can be aUserModel
,CartModel
orOrderModel
- Returns:
- a new, not persisted address
- Throws:
java.lang.IllegalArgumentException
- if the given owner isnull
-
getAddressesForOwner
java.util.Collection<AddressModel> getAddressesForOwner(ItemModel owner)
Gets aCollection
ofaddresses
for the given owner e.g. a user or an order.The owner can be any item.
- Parameters:
owner
- the given owner, can be an order, a cart or a user- Returns:
- an empty collection if nothing was found
- Throws:
java.lang.IllegalArgumentException
- if the given owner isnull
-
cloneAddress
AddressModel cloneAddress(AddressModel address)
Clones an address and sets a link on the new address to the original address.The new address has the same owner as the given address.
- Parameters:
address
- the address to clone- Returns:
- a new created, not persisted clone of the given address
- Throws:
java.lang.IllegalArgumentException
- if the given address isnull
-
cloneAddressForOwner
AddressModel cloneAddressForOwner(AddressModel address, ItemModel owner)
Clones an address but for the given owner and sets a link on the new address to the original address.- Parameters:
address
- the address to cloneowner
- the owner of the new cloned address- Returns:
- a new created,
not persisted
clone of the given address - Throws:
java.lang.IllegalArgumentException
- if the given address isnull
or the given owner isnull
-
-