Skip to contentPackage: AddressXml
AddressXml
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * blueHour: open source accounting
5: * http://tidalwave.it/projects/bluehour
6: *
7: * Copyright (C) 2013 - 2024 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/bluehour-src
22: * git clone https://github.com/tidalwave-it/bluehour-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.accounting.exporter.xml.impl.xml;
27:
28: import javax.annotation.Nonnull;
29: import javax.xml.bind.annotation.XmlAccessorOrder;
30: import javax.xml.bind.annotation.XmlAccessorType;
31: import javax.xml.bind.annotation.XmlElement;
32: import javax.xml.bind.annotation.XmlRootElement;
33: import it.tidalwave.accounting.model.types.Address;
34: import lombok.NoArgsConstructor;
35: import static javax.xml.bind.annotation.XmlAccessOrder.ALPHABETICAL;
36: import static javax.xml.bind.annotation.XmlAccessType.FIELD;
37:
38: /***************************************************************************************************************************************************************
39: *
40: * @author Fabrizio Giudici
41: *
42: **************************************************************************************************************************************************************/
43: @NoArgsConstructor
44: @XmlRootElement(name = "address") @XmlAccessorType(FIELD) @XmlAccessorOrder(ALPHABETICAL)
45: public class AddressXml
46: {
47: @XmlElement(name = "street")
48: private String street;
49:
50: @XmlElement(name = "city")
51: private String city;
52:
53: @XmlElement(name = "zip")
54: private String zip;
55:
56: @XmlElement(name = "state")
57: private String state;
58:
59: @XmlElement(name = "country")
60: private String country;
61:
62: public AddressXml (@Nonnull final Address address)
63: {
64: this.street = address.getStreet();
65: this.city = address.getCity();
66: this.zip = address.getZip();
67: this.state = address.getState();
68: this.country = address.getCountry();
69: }
70:
71: @Nonnull
72: public Address toAddress()
73: {
74: return Address.builder().withStreet(street)
75: .withCity(city)
76: .withZip(zip)
77: .withState(state)
78: .withCountry(country)
79: .create();
80: }
81: }