Skip to contentPackage: Address
Address
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.model.types;
27:
28: import javax.annotation.Nonnull;
29: import javax.annotation.concurrent.Immutable;
30: import lombok.AllArgsConstructor;
31: import lombok.EqualsAndHashCode;
32: import lombok.Getter;
33: import lombok.ToString;
34: import lombok.With;
35: import static lombok.AccessLevel.PRIVATE;
36:
37: /***************************************************************************************************************************************************************
38: *
39: * This class models the address of a customer.
40: *
41: * @author Fabrizio Giudici
42: *
43: **************************************************************************************************************************************************************/
44: @Immutable @Getter @EqualsAndHashCode @ToString
45: public class Address
46: {
47: public static final Address EMPTY = builder().create();
48:
49: @AllArgsConstructor(access = PRIVATE)
50: @Immutable @With @Getter @ToString
51: public static class Builder
52: {
53: private final String street;
54: private final String city;
55: private final String zip;
56: private final String state;
57: private final String country;
58:
59: @Nonnull
60: public Address create()
61: {
62: return new Address(this);
63: }
64: }
65:
66: @Nonnull
67: private final String street;
68:
69: @Nonnull
70: private final String city;
71:
72: @Nonnull
73: private final String state;
74:
75: @Nonnull
76: private final String country;
77:
78: @Nonnull
79: private final String zip;
80:
81: /***********************************************************************************************************************************************************
82: *
83: **********************************************************************************************************************************************************/
84: @Nonnull
85: public static Builder builder()
86: {
87: return new Builder("", "", "", "", "");
88: }
89:
90: /***********************************************************************************************************************************************************
91: *
92: **********************************************************************************************************************************************************/
93: protected Address (@Nonnull final Builder builder)
94: {
95: this.street = builder.getStreet();
96: this.city = builder.getCity();
97: this.zip = builder.getZip();
98: this.state = builder.getState();
99: this.country = builder.getCountry();
100: }
101: }