public static final class MgrsFormat.Builder extends Object implements AutoCloseable
MgrsFormat
.
Example usage:
MgrsFormat mgrsFormat = MgrsFormat.newBuilder()
.precision(MgrsFormatPrecision.Precision1M)
.formatType(MgrsFormatType.Mgrs)
.zoneSeparator(" ")
.coordinateSeparator(" ")
.build();
Constructor and Description |
---|
Builder(MgrsFormat.Builder other) |
Modifier and Type | Method and Description |
---|---|
MgrsFormat |
build()
Creates the MGRS format, based on the properties set on this builder.
|
void |
close() |
MgrsFormat.Builder |
coordinateSeparator(String coordinateSeparator)
Sets the string to separate the zone/grid letters and the coordinates.
|
protected void |
finalize() |
MgrsFormat.Builder |
formatType(MgrsFormatType formatType)
Sets the
MgrsFormatType . |
MgrsFormat.Builder |
precision(MgrsFormatPrecision precision)
Sets the
MgrsFormatPrecision used to format an MGRS or UTM/UPS string. |
MgrsFormat.Builder |
zoneSeparator(String zoneSeparator)
Sets the string to use as zoneSeparator between the grid zone and the 100km squares when formatting MGRS strings.
|
public Builder(@NotNull MgrsFormat.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public MgrsFormat build() throws IllegalStateException
IllegalStateException
- if the set precision is not compatible with the format type.@NotNull public MgrsFormat.Builder coordinateSeparator(@NotNull String coordinateSeparator)
coordinateSeparator
- the coordinateSeparator. If not set, default is an empty string.@NotNull public MgrsFormat.Builder zoneSeparator(@NotNull String zoneSeparator)
zoneSeparator
- the zoneSeparator. If not set, default is an empty string.@NotNull public MgrsFormat.Builder precision(@NotNull MgrsFormatPrecision precision)
MgrsFormatPrecision
used to format an MGRS or UTM/UPS string.
MgrsFormatPrecision#Precision1000KM
and MgrsFormatPrecision#PrecisionGridZone
may not be used when the format type is set to MgrsFormatType#Mgrs
.
precision
- the precision. If not set, deafault is MgrsFormatPrecision#Precision1M
.@NotNull public MgrsFormat.Builder formatType(@NotNull MgrsFormatType formatType)
MgrsFormatType
.formatType
-