Package net.sf.eBusx.geo
Class Position.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EField.Builder<Position>
-
- net.sf.eBusx.geo.Position.Builder
-
- Enclosing class:
- Position
public static final class Position.Builder extends EField.Builder<Position>
Position
instances may be created only by using aBuilder
instance. ABuilder
instance is obtained by callingPosition.builder()
which returns a newly instantiated builder instance. Once obtained, call the setter methods for each field andEMessageObject.Builder.build()
to create aPosition
instance.
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.messages.EMessageObject.Builder
mTargetClass
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Position
buildImpl()
Returns a new position instance based on this builder's settings.Position.Builder
elevation(java.math.BigDecimal elevation)
Sets position elevation.Position.Builder
latitude(java.math.BigDecimal latitude)
Sets position latitude.Position.Builder
longitude(java.math.BigDecimal longitude)
Sets position longitude.protected Validator
validate(Validator problems)
Checks if latitude and longitude are set.-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
validate
protected Validator validate(Validator problems)
Checks if latitude and longitude are set. Elevation may be null.- Overrides:
validate
in classEField.Builder<Position>
- Parameters:
problems
- add each detected problem to this validator.- Returns:
problems
.- See Also:
Validator
-
buildImpl
protected Position buildImpl()
Returns a new position instance based on this builder's settings.- Specified by:
buildImpl
in classEMessageObject.Builder<Position>
- Returns:
- new position instance.
-
latitude
public Position.Builder latitude(java.math.BigDecimal latitude)
Sets position latitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
latitude
- position latitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifposition
isnull
.java.lang.IllegalArgumentException
- iflatitude
<GeoObject.MIN_LATITUDE
or >GeoObject.MAX_LATITUDE
.
-
longitude
public Position.Builder longitude(java.math.BigDecimal longitude)
Sets position longitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
longitude
- position longitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- iflongitude
isnull
.java.lang.IllegalArgumentException
- iflongitude
<GeoObject.MIN_LONGITUDE
or >GeoObject.MAX_LONGITUDE
.
-
elevation
public Position.Builder elevation(java.math.BigDecimal elevation)
Sets position elevation. Returnsthis Builder
instance so that builder method calls can be chained. May be set tonull
. All values are accepted.- Parameters:
elevation
- position elevation.- Returns:
this Builder
instance.
-
-