Package net.sf.eBusx.geo
Class GeoPolygon.Builder
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject.Builder<M>
-
- net.sf.eBus.messages.EField.Builder<F>
-
- net.sf.eBusx.geo.GeoObject.GeoBuilder<GeoPolygon>
-
- net.sf.eBusx.geo.GeoPolygon.Builder
-
- Enclosing class:
- GeoPolygon
public static final class GeoPolygon.Builder extends GeoObject.GeoBuilder<GeoPolygon>
Builder class used to createGeoPolygon
instances. ABuilder
instance is obtained by callingGeoPolygon.builder()
method.
-
-
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 GeoPolygon.Builder
add(LineString ring)
Appends linear ring to rings list.GeoPolygon.Builder
addAll(java.util.Collection<LineString> rings)
Appends linear rings collection to linear rings list.GeoPolygon.Builder
addAll(LineString[] rings)
Appends linear rings array to linear rings list.protected GeoPolygon
buildImpl()
Returns a newGeoPolygon
instance created from this builder's validated settings.GeoPolygon.Builder
linearRings(LineString[] rings)
Sets linear rings list to the given linear ring values.protected Validator
validate(Validator problems)
Check if: at least one linear ring was provided, each linear ring has at least four positions, and each linear ring isis closed
.-
Methods inherited from class net.sf.eBusx.geo.GeoObject.GeoBuilder
boundingBox, type
-
Methods inherited from class net.sf.eBus.messages.EMessageObject.Builder
build
-
-
-
-
Method Detail
-
validate
protected Validator validate(Validator problems)
Check if:- at least one linear ring was provided,
- each linear ring has at least four positions, and
-
each linear ring is
is closed
.
- Overrides:
validate
in classEField.Builder<GeoPolygon>
- Parameters:
problems
- append detected problems to this validator.- Returns:
problems
to allow for method chaining.- See Also:
Validator
-
buildImpl
protected GeoPolygon buildImpl()
Returns a newGeoPolygon
instance created from this builder's validated settings.- Specified by:
buildImpl
in classEMessageObject.Builder<GeoPolygon>
- Returns:
- new GeoJSON polygon instance.
-
add
public GeoPolygon.Builder add(LineString ring)
Appends linear ring to rings list.- Parameters:
ring
- add this linear ring.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifring
isnull
.- See Also:
addAll(LineString[])
,addAll(Collection)
,linearRings(LineString[])
-
addAll
public GeoPolygon.Builder addAll(LineString[] rings)
Appends linear rings array to linear rings list.- Parameters:
rings
- append all rings to list.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifrings
isnull
.- See Also:
add(LineString)
,addAll(Collection)
,linearRings(LineString[])
-
addAll
public GeoPolygon.Builder addAll(java.util.Collection<LineString> rings)
Appends linear rings collection to linear rings list.- Parameters:
rings
- append all rings to list.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifrings
isnull
.- See Also:
add(LineString)
,addAll(LineString[])
,linearRings(LineString[])
-
linearRings
public GeoPolygon.Builder linearRings(LineString[] rings)
Sets linear rings list to the given linear ring values. Note that all previously added rings are removed from the list prior to adding these rings but only after verifying that the linear rings array is notnull
.- Parameters:
rings
- set linear rings list to this array.- Returns:
this Builder
instance.- Throws:
java.lang.NullPointerException
- ifrings
isnull
. If this exception is thrown then linear rings list is unchanged.- See Also:
add(LineString)
,addAll(LineString[])
,addAll(Collection)
-
-