@Test public void doConvert() { Assert.assertEquals( new Location( 10.91, -67.124 ), converter.convert( "[10.91,-67.124]" ) ); }
@Nullable @Override public Location doConvert( @Nonnull String source ) throws ConversionException { final Matcher matcher = LOCATION_PATTERN.matcher( source ); if ( !matcher.matches() ) { throw new ConversionException( "Not a valid location: " + source ); } try { return new Location( Double.valueOf( matcher.group( 1 ) ), Double.valueOf( matcher.group( 2 ) ) ); } catch ( NumberFormatException e ) { throw new ConversionException( "Not a valid location: " + source ); } }
StringToLocationConverter extends TypedConverter<String, Location> { @Nullable @Override public Location doConvert( @Nonnull String source ) throws ConversionException { final Matcher matcher = LOCATION_PATTERN.matcher( source ); if ( !matcher.matches() ) { throw new ConversionException( "Not a valid location: " + source ); } try { return new Location( Double.valueOf( matcher.group( 1 ) ), Double.valueOf( matcher.group( 2 ) ) ); } catch ( NumberFormatException e ) { throw new ConversionException( "Not a valid location: " + source ); } } }
StringToLocationConverter extends TypedConverter<String, Location> { @Nullable @Override public Location doConvert( @Nonnull String source ) throws ConversionException { final Matcher matcher = LOCATION_PATTERN.matcher( source ); if ( !matcher.matches() ) { throw new ConversionException( "Not a valid location: " + source ); } try { return new Location( Double.valueOf( matcher.group( 1 ) ), Double.valueOf( matcher.group( 2 ) ) ); } catch ( NumberFormatException e ) { throw new ConversionException( "Not a valid location: " + source ); } } StringToLocationConverter(); }
StringToLocationConverter extends TypedConverter<String, Location> { @Nullable @Override public Location doConvert( @Nonnull String source ) throws ConversionException { final Matcher matcher = LOCATION_PATTERN.matcher( source ); if ( !matcher.matches() ) { throw new ConversionException( "Not a valid location: " + source ); } try { return new Location( Double.valueOf( matcher.group( 1 ) ), Double.valueOf( matcher.group( 2 ) ) ); } catch ( NumberFormatException e ) { throw new ConversionException( "Not a valid location: " + source ); } } StringToLocationConverter(); @Nullable @Override Location doConvert( @Nonnull String source ); static boolean isLocation( @Nullable String source ); }
StringToLocationConverter extends TypedConverter<String, Location> { @Nullable @Override public Location doConvert( @Nonnull String source ) throws ConversionException { final Matcher matcher = LOCATION_PATTERN.matcher( source ); if ( !matcher.matches() ) { throw new ConversionException( "Not a valid location: " + source ); } try { return new Location( Double.valueOf( matcher.group( 1 ) ), Double.valueOf( matcher.group( 2 ) ) ); } catch ( NumberFormatException e ) { throw new ConversionException( "Not a valid location: " + source ); } } StringToLocationConverter(); @Nullable @Override Location doConvert( @Nonnull String source ); static boolean isLocation( @Nullable String source );  }