Package net.sf.eBusx.geo
Class BoundingBox.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EField.Builder<BoundingBox>
-
- net.sf.eBusx.geo.BoundingBox.Builder
-
- Enclosing class:
- BoundingBox
public static final class BoundingBox.Builder extends EField.Builder<BoundingBox>
ABuilder
instance is the only was to create aBoundingBox
instance. The only way to obtain aBuilder
instance is viaBoundingBox.builder()
. Use the builder instance to set the bounding box latitude and longitude points and then callEMessageObject.Builder.build()
to generate the bounding box instance.It is recommended that a new builder instance be used for each new bounding box instance. Builder instance re-use is discouraged.
-
-
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 BoundingBox
buildImpl()
Returns a new bounding box instance based on this builder's settings.BoundingBox.Builder
maxLatitude(java.math.BigDecimal max)
Sets northern bounding box latitude.BoundingBox.Builder
maxLongitude(java.math.BigDecimal max)
Sets eastern bounding box longitude.BoundingBox.Builder
minLatitude(java.math.BigDecimal min)
Sets southern bounding box latitude.BoundingBox.Builder
minLongitude(java.math.BigDecimal min)
Sets western bounding box longitude.protected Validator
validate(Validator problems)
Checks if: all four bounding box points are set, minimum latitude ≤ maximum latitude, and minimum longitude ≤ maximum longitude.-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
validate
protected Validator validate(Validator problems)
Checks if:- all four bounding box points are set,
- minimum latitude ≤ maximum latitude, and
- minimum longitude ≤ maximum longitude.
- Overrides:
validate
in classEField.Builder<BoundingBox>
- Parameters:
problems
- add each detected problem to this validator.- Returns:
problem
- See Also:
Validator
-
buildImpl
protected BoundingBox buildImpl()
Returns a new bounding box instance based on this builder's settings.- Specified by:
buildImpl
in classEMessageObject.Builder<BoundingBox>
- Returns:
- new bounding box instance.
-
minLatitude
public BoundingBox.Builder minLatitude(java.math.BigDecimal min)
Sets southern bounding box latitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
min
- southern or minimum latitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifmin
isnull
.java.lang.IllegalArgumentException
- ifmin
<GeoObject.MIN_LATITUDE
or >GeoObject.MAX_LATITUDE
.
-
maxLatitude
public BoundingBox.Builder maxLatitude(java.math.BigDecimal max)
Sets northern bounding box latitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
max
- northern or maximum latitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifmax
isnull
.java.lang.IllegalArgumentException
- ifmax
<GeoObject.MIN_LATITUDE
or >GeoObject.MAX_LATITUDE
.
-
minLongitude
public BoundingBox.Builder minLongitude(java.math.BigDecimal min)
Sets western bounding box longitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
min
- western or minimum latitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifmin
isnull
.java.lang.IllegalArgumentException
- ifmin
<GeoObject.MIN_LONGITUDE
or >GeoObject.MAX_LONGITUDE
.
-
maxLongitude
public BoundingBox.Builder maxLongitude(java.math.BigDecimal max)
Sets eastern bounding box longitude. Returnsthis Builder
instance so that builder method calls can be chained.- Parameters:
max
- eastern or maximum latitude.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifmax
isnull
.java.lang.IllegalArgumentException
- ifmax
<GeoObject.MIN_LONGITUDE
or >GeoObject.MAX_LONGITUDE
.
-
-