Skip to content

Commit f43c943

Browse files
Tony Fendalljricher
authored andcommitted
Change Address model to be an interface. Will allow consuming projects
to override this funcitonality more easily.
1 parent c4726b0 commit f43c943

File tree

3 files changed

+262
-179
lines changed

3 files changed

+262
-179
lines changed

openid-connect-common/src/main/java/org/mitre/openid/connect/model/Address.java

Lines changed: 25 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -18,219 +18,66 @@
1818

1919
import java.io.Serializable;
2020

21-
import javax.persistence.Basic;
22-
import javax.persistence.Column;
23-
import javax.persistence.Entity;
24-
import javax.persistence.GeneratedValue;
25-
import javax.persistence.GenerationType;
26-
import javax.persistence.Id;
27-
import javax.persistence.Table;
28-
29-
@Entity
30-
@Table(name="address")
31-
public class Address implements Serializable {
32-
33-
private static final long serialVersionUID = -1304880008685206811L;
34-
35-
private Long id;
36-
private String formatted;
37-
private String streetAddress;
38-
private String locality;
39-
private String region;
40-
private String postalCode;
41-
private String country;
21+
public interface Address extends Serializable {
4222

4323
/**
44-
* Empty constructor
24+
* @return the formatted address
4525
*/
46-
public Address() {
47-
48-
}
49-
50-
/**
51-
* @return the formatted address string
52-
*/
53-
@Basic
54-
@Column(name = "formatted")
55-
public String getFormatted() {
56-
return formatted;
57-
}
26+
public String getFormatted();
27+
5828
/**
5929
* @param formatted the formatted address to set
6030
*/
61-
public void setFormatted(String formatted) {
62-
this.formatted = formatted;
63-
}
31+
public void setFormatted(String formatted);
32+
6433
/**
6534
* @return the streetAddress
6635
*/
67-
@Basic
68-
@Column(name="street_address")
69-
public String getStreetAddress() {
70-
return streetAddress;
71-
}
36+
public String getStreetAddress();
37+
7238
/**
7339
* @param streetAddress the streetAddress to set
7440
*/
75-
public void setStreetAddress(String streetAddress) {
76-
this.streetAddress = streetAddress;
77-
}
41+
public void setStreetAddress(String streetAddress);
42+
7843
/**
7944
* @return the locality
8045
*/
81-
@Basic
82-
@Column(name = "locality")
83-
public String getLocality() {
84-
return locality;
85-
}
46+
public String getLocality();
47+
8648
/**
8749
* @param locality the locality to set
8850
*/
89-
public void setLocality(String locality) {
90-
this.locality = locality;
91-
}
51+
public void setLocality(String locality);
52+
9253
/**
9354
* @return the region
9455
*/
95-
@Basic
96-
@Column(name = "region")
97-
public String getRegion() {
98-
return region;
99-
}
56+
public String getRegion();
57+
10058
/**
10159
* @param region the region to set
10260
*/
103-
public void setRegion(String region) {
104-
this.region = region;
105-
}
61+
public void setRegion(String region);
62+
10663
/**
10764
* @return the postalCode
10865
*/
109-
@Basic
110-
@Column(name="postal_code")
111-
public String getPostalCode() {
112-
return postalCode;
113-
}
66+
public String getPostalCode();
67+
11468
/**
11569
* @param postalCode the postalCode to set
11670
*/
117-
public void setPostalCode(String postalCode) {
118-
this.postalCode = postalCode;
119-
}
71+
public void setPostalCode(String postalCode);
72+
12073
/**
12174
* @return the country
12275
*/
123-
@Basic
124-
@Column(name = "country")
125-
public String getCountry() {
126-
return country;
127-
}
76+
public String getCountry();
77+
12878
/**
12979
* @param country the country to set
13080
*/
131-
public void setCountry(String country) {
132-
this.country = country;
133-
}
134-
135-
/**
136-
* @return the id
137-
*/
138-
@Id
139-
@GeneratedValue(strategy=GenerationType.IDENTITY)
140-
@Column(name = "id")
141-
public Long getId() {
142-
return id;
143-
}
144-
145-
/**
146-
* @param id the id to set
147-
*/
148-
public void setId(Long id) {
149-
this.id = id;
150-
}
151-
152-
/* (non-Javadoc)
153-
* @see java.lang.Object#hashCode()
154-
*/
155-
@Override
156-
public int hashCode() {
157-
final int prime = 31;
158-
int result = 1;
159-
result = prime * result + ((country == null) ? 0 : country.hashCode());
160-
result = prime * result + ((formatted == null) ? 0 : formatted.hashCode());
161-
result = prime * result + ((id == null) ? 0 : id.hashCode());
162-
result = prime * result + ((locality == null) ? 0 : locality.hashCode());
163-
result = prime * result + ((postalCode == null) ? 0 : postalCode.hashCode());
164-
result = prime * result + ((region == null) ? 0 : region.hashCode());
165-
result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode());
166-
return result;
167-
}
168-
169-
/* (non-Javadoc)
170-
* @see java.lang.Object#equals(java.lang.Object)
171-
*/
172-
@Override
173-
public boolean equals(Object obj) {
174-
if (this == obj) {
175-
return true;
176-
}
177-
if (obj == null) {
178-
return false;
179-
}
180-
if (!(obj instanceof Address)) {
181-
return false;
182-
}
183-
Address other = (Address) obj;
184-
if (country == null) {
185-
if (other.country != null) {
186-
return false;
187-
}
188-
} else if (!country.equals(other.country)) {
189-
return false;
190-
}
191-
if (formatted == null) {
192-
if (other.formatted != null) {
193-
return false;
194-
}
195-
} else if (!formatted.equals(other.formatted)) {
196-
return false;
197-
}
198-
if (id == null) {
199-
if (other.id != null) {
200-
return false;
201-
}
202-
} else if (!id.equals(other.id)) {
203-
return false;
204-
}
205-
if (locality == null) {
206-
if (other.locality != null) {
207-
return false;
208-
}
209-
} else if (!locality.equals(other.locality)) {
210-
return false;
211-
}
212-
if (postalCode == null) {
213-
if (other.postalCode != null) {
214-
return false;
215-
}
216-
} else if (!postalCode.equals(other.postalCode)) {
217-
return false;
218-
}
219-
if (region == null) {
220-
if (other.region != null) {
221-
return false;
222-
}
223-
} else if (!region.equals(other.region)) {
224-
return false;
225-
}
226-
if (streetAddress == null) {
227-
if (other.streetAddress != null) {
228-
return false;
229-
}
230-
} else if (!streetAddress.equals(other.streetAddress)) {
231-
return false;
232-
}
233-
return true;
234-
}
81+
public void setCountry(String country);
23582

23683
}

0 commit comments

Comments
 (0)