Package google.registry.model.eppcommon
Class Address
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.eppcommon.Address
-
- All Implemented Interfaces:
Jsonifiable
,UnsafeSerializable
,GsonUtils.GsonPostProcessable
,java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ContactAddress
,MarkAddress
,RegistrarAddress
@Embeddable @MappedSuperclass public class Address extends ImmutableObject implements Jsonifiable, UnsafeSerializable, GsonUtils.GsonPostProcessable
Container for generic street address.This is the "addrType" type from RFC5733. It also matches the "addrType" type from Mark and Signed Mark Objects Mapping.
- See Also:
ContactAddress
,MarkAddress
,RegistrarAddress
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Address.Builder<T extends Address>
A builder for constructingAddress
.-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotHydrate, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
city
protected java.lang.String
countryCode
protected java.lang.String
state
protected java.util.List<java.lang.String>
street
At most three lines of addresses parsed from XML elements.protected java.lang.String
streetLine1
protected java.lang.String
streetLine2
protected java.lang.String
streetLine3
protected java.lang.String
zip
-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Constructor Description Address()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Address.Builder<? extends Address>
asBuilder()
java.lang.String
getCity()
java.lang.String
getCountryCode()
java.lang.String
getState()
com.google.common.collect.ImmutableList<java.lang.String>
getStreet()
java.lang.String
getZip()
void
postProcess()
java.util.Map<java.lang.String,java.lang.Object>
toJsonMap()
Returns a JSON representation of this object.-
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, createVKey, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toString, toStringHelper
-
-
-
-
Field Detail
-
street
@Expose protected java.util.List<java.lang.String> street
At most three lines of addresses parsed from XML elements.This field is used to marshal to/unmarshal from XML elements. When persisting to/from SQL, the next three separate fields are used. Those lines are only used for persistence purpose and should not be directly used in Java.
We need to keep the list and the three fields in sync in all the following scenarios when an entity containing a
Address
is created:- When creating an
Address
directly in java, using theAddress.Builder
: TheAddress.Builder.setStreet(ImmutableList)
sets both the list and the fields. - When unmarshalling from XML: The list will be set based on the content of the XML.
Afterwards,
afterUnmarshal(Unmarshaller, Object)
} will be called to set the fields. - When loading from the database: The fields will be set by the values in SQL. Afterwards,
postLoad()
will be called to set the list.
Schema validation will enforce the 3-line limit.
- When creating an
-
streetLine1
@IgnoredInDiffableMap protected java.lang.String streetLine1
-
streetLine2
@IgnoredInDiffableMap protected java.lang.String streetLine2
-
streetLine3
@IgnoredInDiffableMap protected java.lang.String streetLine3
-
city
@Expose protected java.lang.String city
-
state
@Expose protected java.lang.String state
-
zip
@Expose protected java.lang.String zip
-
countryCode
@Expose protected java.lang.String countryCode
-
-
Method Detail
-
getStreet
public com.google.common.collect.ImmutableList<java.lang.String> getStreet()
-
getCity
public java.lang.String getCity()
-
getState
public java.lang.String getState()
-
getZip
public java.lang.String getZip()
-
getCountryCode
public java.lang.String getCountryCode()
-
toJsonMap
public java.util.Map<java.lang.String,java.lang.Object> toJsonMap()
Description copied from interface:Jsonifiable
Returns a JSON representation of this object.The returned value must not return sensitive fields, so that it may be safe to return to the client via an API response.
- Specified by:
toJsonMap
in interfaceJsonifiable
-
asBuilder
public Address.Builder<? extends Address> asBuilder()
-
postProcess
public void postProcess()
- Specified by:
postProcess
in interfaceGsonUtils.GsonPostProcessable
-
-