Updates

Julien LepillerSat Oct 13 14:38:31+0200 2018

53d6183

Updates

java-spring-framework-remove-non-free.patch

1-
From 45ff8f9aff1ce08546b091505a706b1baf1bcb7b Mon Sep 17 00:00:00 2001
1+
From 03942913eb3b3a6458030856bfecc8a6927ab1ba Mon Sep 17 00:00:00 2001
22
From: Julien Lepiller <julien@lepiller.eu>
3-
Date: Sat, 15 Sep 2018 00:09:39 +0200
3+
Date: Sat, 15 Sep 2018 10:27:46 +0200
44
Subject: [PATCH] Remove dependency on jsr354 (javax.currency).
55
66
jsr354 is a non-free package:
77
https://github.com/JavaMoney/jsr354-api/blob/master/EVALUATION-LICENCE.txt
88
---
9-
 .../DefaultFormattingConversionService.java   |  10 -
10-
 .../number/money/MoneyFormattingTests.java    | 272 ------------------
11-
 2 files changed, 282 deletions(-)
12-
 delete mode 100644 spring-context/src/test/java/org/springframework/format/number/money/MoneyFormattingTests.java
9+
 .../number/money/CurrencyUnitFormatter.java   |  44 -----
10+
 ...umberFormatAnnotationFormatterFactory.java | 163 ------------------
11+
 .../number/money/MonetaryAmountFormatter.java |  96 -----------
12+
 .../format/number/money/package-info.java     |   4 -
13+
 .../DefaultFormattingConversionService.java   |  10 --
14+
 5 files changed, 317 deletions(-)
15+
 delete mode 100644 spring-context/src/main/java/org/springframework/format/number/money/CurrencyUnitFormatter.java
16+
 delete mode 100644 spring-context/src/main/java/org/springframework/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java
17+
 delete mode 100644 spring-context/src/main/java/org/springframework/format/number/money/MonetaryAmountFormatter.java
18+
 delete mode 100644 spring-context/src/main/java/org/springframework/format/number/money/package-info.java
1319
14-
diff --git a/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java b/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
15-
index 2c7c60a..5e38006 100644
16-
--- a/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
17-
+++ b/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
18-
@@ -21,9 +21,6 @@ import org.springframework.format.FormatterRegistry;
19-
 import org.springframework.format.datetime.DateFormatterRegistrar;
20-
 import org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar;
21-
 import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
22-
-import org.springframework.format.number.money.CurrencyUnitFormatter;
23-
-import org.springframework.format.number.money.Jsr354NumberFormatAnnotationFormatterFactory;
24-
-import org.springframework.format.number.money.MonetaryAmountFormatter;
25-
 import org.springframework.format.number.NumberFormatAnnotationFormatterFactory;
26-
 import org.springframework.util.ClassUtils;
27-
 import org.springframework.util.StringValueResolver;
28-
@@ -104,13 +101,6 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
29-
 		// Default handling of number values
30-
 		formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
31-
 
32-
-		// Default handling of monetary values
33-
-		if (jsr354Present) {
34-
-			formatterRegistry.addFormatter(new CurrencyUnitFormatter());
35-
-			formatterRegistry.addFormatter(new MonetaryAmountFormatter());
36-
-			formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory());
37-
-		}
38-
-
39-
 		// Default handling of date-time values
40-
 		if (jsr310Present) {
41-
 			// just handling JSR-310 specific date and time types
42-
diff --git a/spring-context/src/test/java/org/springframework/format/number/money/MoneyFormattingTests.java b/spring-context/src/test/java/org/springframework/format/number/money/MoneyFormattingTests.java
20+
diff --git a/spring-context/src/main/java/org/springframework/format/number/money/CurrencyUnitFormatter.java b/spring-context/src/main/java/org/springframework/format/number/money/CurrencyUnitFormatter.java
4321
deleted file mode 100644
44-
index 28df446..0000000
45-
--- a/spring-context/src/test/java/org/springframework/format/number/money/MoneyFormattingTests.java
22+
index d3f4749..0000000
23+
--- a/spring-context/src/main/java/org/springframework/format/number/money/CurrencyUnitFormatter.java
4624
+++ /dev/null
47-
@@ -1,272 +0,0 @@
25+
@@ -1,44 +0,0 @@
4826
-/*
4927
- * Copyright 2002-2015 the original author or authors.
5028
- *

6543
-
6644
-import java.util.Locale;
6745
-import javax.money.CurrencyUnit;
68-
-import javax.money.MonetaryAmount;
69-
-
70-
-import org.junit.After;
71-
-import org.junit.Before;
72-
-import org.junit.Test;
46+
-import javax.money.Monetary;
7347
-
74-
-import org.springframework.beans.MutablePropertyValues;
75-
-import org.springframework.context.i18n.LocaleContextHolder;
76-
-import org.springframework.format.annotation.NumberFormat;
77-
-import org.springframework.format.support.DefaultFormattingConversionService;
78-
-import org.springframework.format.support.FormattingConversionService;
79-
-import org.springframework.validation.DataBinder;
80-
-
81-
-import static org.junit.Assert.*;
48+
-import org.springframework.format.Formatter;
8249
-
8350
-/**
51+
- * Formatter for JSR-354 {@link javax.money.CurrencyUnit} values,
52+
- * from and to currency code Strings.
53+
- *
8454
- * @author Juergen Hoeller
8555
- * @since 4.2
8656
- */
87-
-public class MoneyFormattingTests {
57+
-public class CurrencyUnitFormatter implements Formatter<CurrencyUnit> {
8858
-
89-
-	private final FormattingConversionService conversionService = new DefaultFormattingConversionService();
90-
-
91-
-
92-
-	@Before
93-
-	public void setUp() {
94-
-		LocaleContextHolder.setLocale(Locale.US);
59+
-	@Override
60+
-	public String print(CurrencyUnit object, Locale locale) {
61+
-		return object.getCurrencyCode();
9562
-	}
9663
-
97-
-	@After
98-
-	public void tearDown() {
99-
-		LocaleContextHolder.setLocale(null);
64+
-	@Override
65+
-	public CurrencyUnit parse(String text, Locale locale) {
66+
-		return Monetary.getCurrency(text);
10067
-	}
10168
-
69+
-}
70+
diff --git a/spring-context/src/main/java/org/springframework/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java
71+
deleted file mode 100644
72+
index 6cec059..0000000
73+
--- a/spring-context/src/main/java/org/springframework/format/number/money/Jsr354NumberFormatAnnotationFormatterFactory.java
74+
+++ /dev/null
75+
@@ -1,163 +0,0 @@
76+
-/*
77+
- * Copyright 2002-2015 the original author or authors.
78+
- *
79+
- * Licensed under the Apache License, Version 2.0 (the "License");
80+
- * you may not use this file except in compliance with the License.
81+
- * You may obtain a copy of the License at
82+
- *
83+
- *      http://www.apache.org/licenses/LICENSE-2.0
84+
- *
85+
- * Unless required by applicable law or agreed to in writing, software
86+
- * distributed under the License is distributed on an "AS IS" BASIS,
87+
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
88+
- * See the License for the specific language governing permissions and
89+
- * limitations under the License.
90+
- */
91+
-
92+
-package org.springframework.format.number.money;
10293
-
103-
-	@Test
104-
-	public void testAmountAndUnit() {
105-
-		MoneyHolder bean = new MoneyHolder();
106-
-		DataBinder binder = new DataBinder(bean);
107-
-		binder.setConversionService(conversionService);
108-
-
109-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
110-
-		propertyValues.add("amount", "USD 10.50");
111-
-		propertyValues.add("unit", "USD");
112-
-		binder.bind(propertyValues);
113-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
114-
-		assertEquals("USD10.50", binder.getBindingResult().getFieldValue("amount"));
115-
-		assertEquals("USD", binder.getBindingResult().getFieldValue("unit"));
116-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
117-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
118-
-
119-
-		LocaleContextHolder.setLocale(Locale.CANADA);
120-
-		binder.bind(propertyValues);
121-
-		LocaleContextHolder.setLocale(Locale.US);
122-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
123-
-		assertEquals("USD10.50", binder.getBindingResult().getFieldValue("amount"));
124-
-		assertEquals("USD", binder.getBindingResult().getFieldValue("unit"));
125-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
126-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
127-
-	}
94+
-import java.text.ParseException;
95+
-import java.util.Collections;
96+
-import java.util.Currency;
97+
-import java.util.Locale;
98+
-import java.util.Set;
99+
-import javax.money.CurrencyUnit;
100+
-import javax.money.Monetary;
101+
-import javax.money.MonetaryAmount;
128102
-
129-
-	@Test
130-
-	public void testAmountWithNumberFormat1() {
131-
-		FormattedMoneyHolder1 bean = new FormattedMoneyHolder1();
132-
-		DataBinder binder = new DataBinder(bean);
133-
-		binder.setConversionService(conversionService);
134-
-
135-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
136-
-		propertyValues.add("amount", "$10.50");
137-
-		binder.bind(propertyValues);
138-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
139-
-		assertEquals("$10.50", binder.getBindingResult().getFieldValue("amount"));
140-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
141-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
142-
-
143-
-		LocaleContextHolder.setLocale(Locale.CANADA);
144-
-		binder.bind(propertyValues);
145-
-		LocaleContextHolder.setLocale(Locale.US);
146-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
147-
-		assertEquals("$10.50", binder.getBindingResult().getFieldValue("amount"));
148-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
149-
-		assertEquals("CAD", bean.getAmount().getCurrency().getCurrencyCode());
150-
-	}
103+
-import org.springframework.context.support.EmbeddedValueResolutionSupport;
104+
-import org.springframework.format.AnnotationFormatterFactory;
105+
-import org.springframework.format.Formatter;
106+
-import org.springframework.format.Parser;
107+
-import org.springframework.format.Printer;
108+
-import org.springframework.format.annotation.NumberFormat;
109+
-import org.springframework.format.annotation.NumberFormat.Style;
110+
-import org.springframework.format.number.CurrencyStyleFormatter;
111+
-import org.springframework.format.number.NumberStyleFormatter;
112+
-import org.springframework.format.number.PercentStyleFormatter;
113+
-import org.springframework.util.StringUtils;
151114
-
152-
-	@Test
153-
-	public void testAmountWithNumberFormat2() {
154-
-		FormattedMoneyHolder2 bean = new FormattedMoneyHolder2();
155-
-		DataBinder binder = new DataBinder(bean);
156-
-		binder.setConversionService(conversionService);
157-
-
158-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
159-
-		propertyValues.add("amount", "10.50");
160-
-		binder.bind(propertyValues);
161-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
162-
-		assertEquals("10.5", binder.getBindingResult().getFieldValue("amount"));
163-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
164-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
165-
-	}
115+
-/**
116+
- * Formats {@link javax.money.MonetaryAmount} fields annotated
117+
- * with Spring's common {@link NumberFormat} annotation.
118+
- *
119+
- * @author Juergen Hoeller
120+
- * @since 4.2
121+
- * @see NumberFormat
122+
- */
123+
-public class Jsr354NumberFormatAnnotationFormatterFactory extends EmbeddedValueResolutionSupport
124+
-		implements AnnotationFormatterFactory<NumberFormat> {
125+
-
126+
-	private static final String CURRENCY_CODE_PATTERN = "\u00A4\u00A4";
166127
-
167-
-	@Test
168-
-	public void testAmountWithNumberFormat3() {
169-
-		FormattedMoneyHolder3 bean = new FormattedMoneyHolder3();
170-
-		DataBinder binder = new DataBinder(bean);
171-
-		binder.setConversionService(conversionService);
172-
-
173-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
174-
-		propertyValues.add("amount", "10%");
175-
-		binder.bind(propertyValues);
176-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
177-
-		assertEquals("10%", binder.getBindingResult().getFieldValue("amount"));
178-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 0.1d);
179-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
128+
-
129+
-	@Override
130+
-	@SuppressWarnings("unchecked")
131+
-	public Set<Class<?>> getFieldTypes() {
132+
-		return (Set) Collections.singleton(MonetaryAmount.class);
180133
-	}
181134
-
182-
-	@Test
183-
-	public void testAmountWithNumberFormat4() {
184-
-		FormattedMoneyHolder4 bean = new FormattedMoneyHolder4();
185-
-		DataBinder binder = new DataBinder(bean);
186-
-		binder.setConversionService(conversionService);
187-
-
188-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
189-
-		propertyValues.add("amount", "010.500");
190-
-		binder.bind(propertyValues);
191-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
192-
-		assertEquals("010.500", binder.getBindingResult().getFieldValue("amount"));
193-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
194-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
135+
-	@Override
136+
-	public Printer<MonetaryAmount> getPrinter(NumberFormat annotation, Class<?> fieldType) {
137+
-		return configureFormatterFrom(annotation);
195138
-	}
196139
-
197-
-	@Test
198-
-	public void testAmountWithNumberFormat5() {
199-
-		FormattedMoneyHolder5 bean = new FormattedMoneyHolder5();
200-
-		DataBinder binder = new DataBinder(bean);
201-
-		binder.setConversionService(conversionService);
202-
-
203-
-		MutablePropertyValues propertyValues = new MutablePropertyValues();
204-
-		propertyValues.add("amount", "USD 10.50");
205-
-		binder.bind(propertyValues);
206-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
207-
-		assertEquals("USD 010.500", binder.getBindingResult().getFieldValue("amount"));
208-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
209-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
210-
-
211-
-		LocaleContextHolder.setLocale(Locale.CANADA);
212-
-		binder.bind(propertyValues);
213-
-		LocaleContextHolder.setLocale(Locale.US);
214-
-		assertEquals(0, binder.getBindingResult().getErrorCount());
215-
-		assertEquals("USD 010.500", binder.getBindingResult().getFieldValue("amount"));
216-
-		assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
217-
-		assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
140+
-	@Override
141+
-	public Parser<MonetaryAmount> getParser(NumberFormat annotation, Class<?> fieldType) {
142+
-		return configureFormatterFrom(annotation);
218143
-	}
219144
-
220145
-
221-
-	public static class MoneyHolder {
146+
-	private Formatter<MonetaryAmount> configureFormatterFrom(NumberFormat annotation) {
147+
-		if (StringUtils.hasLength(annotation.pattern())) {
148+
-			return new PatternDecoratingFormatter(resolveEmbeddedValue(annotation.pattern()));
149+
-		}
150+
-		else {
151+
-			Style style = annotation.style();
152+
-			if (style == Style.NUMBER) {
153+
-				return new NumberDecoratingFormatter(new NumberStyleFormatter());
154+
-			}
155+
-			else if (style == Style.PERCENT) {
156+
-				return new NumberDecoratingFormatter(new PercentStyleFormatter());
157+
-			}
158+
-			else {
159+
-				return new NumberDecoratingFormatter(new CurrencyStyleFormatter());
160+
-			}
161+
-		}
162+
-	}
222163
-
223-
-		private MonetaryAmount amount;
224164
-
225-
-		private CurrencyUnit unit;
165+
-	private static class NumberDecoratingFormatter implements Formatter<MonetaryAmount> {
226166
-
227-
-		public MonetaryAmount getAmount() {
228-
-			return amount;
229-
-		}
167+
-		private final Formatter<Number> numberFormatter;
230168
-
231-
-		public void setAmount(MonetaryAmount amount) {
232-
-			this.amount = amount;
169+
-		public NumberDecoratingFormatter(Formatter<Number> numberFormatter) {
170+
-			this.numberFormatter = numberFormatter;
233171
-		}
234172
-
235-
-		public CurrencyUnit getUnit() {
236-
-			return unit;
173+
-		@Override
174+
-		public String print(MonetaryAmount object, Locale locale) {
175+
-			return this.numberFormatter.print(object.getNumber(), locale);
237176
-		}
238177
-
239-
-		public void setUnit(CurrencyUnit unit) {
240-
-			this.unit = unit;
178+
-		@Override
179+
-		public MonetaryAmount parse(String text, Locale locale) throws ParseException {
180+
-			CurrencyUnit currencyUnit = Monetary.getCurrency(locale);
181+
-			Number numberValue = this.numberFormatter.parse(text, locale);
182+
-			return Monetary.getDefaultAmountFactory().setNumber(numberValue).setCurrency(currencyUnit).create();
241183
-		}
242184
-	}
243185
-
244186
-
245-
-	public static class FormattedMoneyHolder1 {
187+
-	private static class PatternDecoratingFormatter implements Formatter<MonetaryAmount> {
246188
-
247-
-		@NumberFormat
248-
-		private MonetaryAmount amount;
189+
-		private final String pattern;
249190
-
250-
-		public MonetaryAmount getAmount() {
251-
-			return amount;
191+
-		public PatternDecoratingFormatter(String pattern) {
192+
-			this.pattern = pattern;
252193
-		}
253194
-
254-
-		public void setAmount(MonetaryAmount amount) {
255-
-			this.amount = amount;
195+
-		@Override
196+
-		public String print(MonetaryAmount object, Locale locale) {
197+
-			CurrencyStyleFormatter formatter = new CurrencyStyleFormatter();
198+
-			formatter.setCurrency(Currency.getInstance(object.getCurrency().getCurrencyCode()));
199+
-			formatter.setPattern(this.pattern);
200+
-			return formatter.print(object.getNumber(), locale);
256201
-		}
257-
-	}
258202
-
259-
-
260-
-	public static class FormattedMoneyHolder2 {
261-
-
262-
-		@NumberFormat(style = NumberFormat.Style.NUMBER)
263-
-		private MonetaryAmount amount;
264-
-
265-
-		public MonetaryAmount getAmount() {
266-
-			return amount;
203+
-		@Override
204+
-		public MonetaryAmount parse(String text, Locale locale) throws ParseException {
205+
-			CurrencyStyleFormatter formatter = new CurrencyStyleFormatter();
206+
-			Currency currency = determineCurrency(text, locale);
207+
-			CurrencyUnit currencyUnit = Monetary.getCurrency(currency.getCurrencyCode());
208+
-			formatter.setCurrency(currency);
209+
-			formatter.setPattern(this.pattern);
210+
-			Number numberValue = formatter.parse(text, locale);
211+
-			return Monetary.getDefaultAmountFactory().setNumber(numberValue).setCurrency(currencyUnit).create();
267212
-		}
268213
-
269-
-		public void setAmount(MonetaryAmount amount) {
270-
-			this.amount = amount;
214+
-		private Currency determineCurrency(String text, Locale locale) {
215+
-			try {
216+
-				if (text.length() < 3) {
217+
-					// Could not possibly contain a currency code ->
218+
-					// try with locale and likely let it fail on parse.
219+
-					return Currency.getInstance(locale);
220+
-				}
221+
-				else if (this.pattern.startsWith(CURRENCY_CODE_PATTERN)) {
222+
-					return Currency.getInstance(text.substring(0, 3));
223+
-				}
224+
-				else if (this.pattern.endsWith(CURRENCY_CODE_PATTERN)) {
225+
-					return Currency.getInstance(text.substring(text.length() - 3));
226+
-				}
227+
-				else {
228+
-					// A pattern without a currency code...
229+
-					return Currency.getInstance(locale);
230+
-				}
231+
-			}
232+
-			catch (IllegalArgumentException ex) {
233+
-				throw new IllegalArgumentException("Cannot determine currency for number value [" + text + "]", ex);
234+
-			}
271235
-		}
272236
-	}
273237
-
238+
-}
239+
diff --git a/spring-context/src/main/java/org/springframework/format/number/money/MonetaryAmountFormatter.java b/spring-context/src/main/java/org/springframework/format/number/money/MonetaryAmountFormatter.java
240+
deleted file mode 100644
241+
index 8d949ac..0000000
242+
--- a/spring-context/src/main/java/org/springframework/format/number/money/MonetaryAmountFormatter.java
243+
+++ /dev/null
244+
@@ -1,96 +0,0 @@
245+
-/*
246+
- * Copyright 2002-2015 the original author or authors.
247+
- *
248+
- * Licensed under the Apache License, Version 2.0 (the "License");
249+
- * you may not use this file except in compliance with the License.
250+
- * You may obtain a copy of the License at
251+
- *
252+
- *      http://www.apache.org/licenses/LICENSE-2.0
253+
- *
254+
- * Unless required by applicable law or agreed to in writing, software
255+
- * distributed under the License is distributed on an "AS IS" BASIS,
256+
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
257+
- * See the License for the specific language governing permissions and
258+
- * limitations under the License.
259+
- */
274260
-
275-
-	public static class FormattedMoneyHolder3 {
261+
-package org.springframework.format.number.money;
276262
-
277-
-		@NumberFormat(style = NumberFormat.Style.PERCENT)
278-
-		private MonetaryAmount amount;
263+
-import java.util.Locale;
264+
-import javax.money.MonetaryAmount;
265+
-import javax.money.format.MonetaryAmountFormat;
266+
-import javax.money.format.MonetaryFormats;
279267
-
280-
-		public MonetaryAmount getAmount() {
281-
-			return amount;
282-
-		}
268+
-import org.springframework.format.Formatter;
283269
-
284-
-		public void setAmount(MonetaryAmount amount) {
285-
-			this.amount = amount;
286-
-		}
287-
-	}
270+
-/**
271+
- * Formatter for JSR-354 {@link javax.money.MonetaryAmount} values,
272+
- * delegating to {@link javax.money.format.MonetaryAmountFormat#format}
273+
- * and {@link javax.money.format.MonetaryAmountFormat#parse}.
274+
- *
275+
- * @author Juergen Hoeller
276+
- * @since 4.2
277+
- * @see #getMonetaryAmountFormat
278+
- */
279+
-public class MonetaryAmountFormatter implements Formatter<MonetaryAmount> {
288280
-
281+
-	private String formatName;
289282
-
290-
-	public static class FormattedMoneyHolder4 {
291283
-
292-
-		@NumberFormat(pattern = "#000.000#")
293-
-		private MonetaryAmount amount;
284+
-	/**
285+
-	 * Create a locale-driven MonetaryAmountFormatter.
286+
-	 */
287+
-	public MonetaryAmountFormatter() {
288+
-	}
294289
-
295-
-		public MonetaryAmount getAmount() {
296-
-			return amount;
297-
-		}
290+
-	/**
291+
-	 * Create a new MonetaryAmountFormatter for the given format name.
292+
-	 * @param formatName the format name, to be resolved by the JSR-354
293+
-	 * provider at runtime
294+
-	 */
295+
-	public MonetaryAmountFormatter(String formatName) {
296+
-		this.formatName = formatName;
297+
-	}
298298
-
299-
-		public void setAmount(MonetaryAmount amount) {
300-
-			this.amount = amount;
301-
-		}
299+
-
300+
-	/**
301+
-	 * Specify the format name, to be resolved by the JSR-354 provider
302+
-	 * at runtime.
303+
-	 * <p>Default is none, obtaining a {@link MonetaryAmountFormat}
304+
-	 * based on the current locale.
305+
-	 */
306+
-	public void setFormatName(String formatName) {
307+
-		this.formatName = formatName;
302308
-	}
303309
-
304310
-
305-
-	public static class FormattedMoneyHolder5 {
311+
-	@Override
312+
-	public String print(MonetaryAmount object, Locale locale) {
313+
-		return getMonetaryAmountFormat(locale).format(object);
314+
-	}
306315
-
307-
-		@NumberFormat(pattern = "\u00A4\u00A4 #000.000#")
308-
-		private MonetaryAmount amount;
316+
-	@Override
317+
-	public MonetaryAmount parse(String text, Locale locale) {
318+
-		return getMonetaryAmountFormat(locale).parse(text);
319+
-	}
309320
-
310-
-		public MonetaryAmount getAmount() {
311-
-			return amount;
312-
-		}
313321
-
314-
-		public void setAmount(MonetaryAmount amount) {
315-
-			this.amount = amount;
322+
-	/**
323+
-	 * Obtain a MonetaryAmountFormat for the given locale.
324+
-	 * <p>The default implementation simply calls
325+
-	 * {@link javax.money.format.MonetaryFormats#getAmountFormat}
326+
-	 * with either the configured format name or the given locale.
327+
-	 * @param locale the current locale
328+
-	 * @return the MonetaryAmountFormat (never {@code null})
329+
-	 * @see #setFormatName
330+
-	 */
331+
-	protected MonetaryAmountFormat getMonetaryAmountFormat(Locale locale) {
332+
-		if (this.formatName != null) {
333+
-			return MonetaryFormats.getAmountFormat(this.formatName);
334+
-		}
335+
-		else {
336+
-			return MonetaryFormats.getAmountFormat(locale);
316337
-		}
317338
-	}
318339
-
319340
-}
341+
diff --git a/spring-context/src/main/java/org/springframework/format/number/money/package-info.java b/spring-context/src/main/java/org/springframework/format/number/money/package-info.java
342+
deleted file mode 100644
343+
index d19fccf..0000000
344+
--- a/spring-context/src/main/java/org/springframework/format/number/money/package-info.java
345+
+++ /dev/null
346+
@@ -1,4 +0,0 @@
347+
-/**
348+
- * Integration with the JSR-354 <code>javax.money</code> package.
349+
- */
350+
-package org.springframework.format.number.money;
351+
diff --git a/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java b/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
352+
index 2c7c60a..5e38006 100644
353+
--- a/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
354+
+++ b/spring-context/src/main/java/org/springframework/format/support/DefaultFormattingConversionService.java
355+
@@ -21,9 +21,6 @@ import org.springframework.format.FormatterRegistry;
356+
 import org.springframework.format.datetime.DateFormatterRegistrar;
357+
 import org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar;
358+
 import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
359+
-import org.springframework.format.number.money.CurrencyUnitFormatter;
360+
-import org.springframework.format.number.money.Jsr354NumberFormatAnnotationFormatterFactory;
361+
-import org.springframework.format.number.money.MonetaryAmountFormatter;
362+
 import org.springframework.format.number.NumberFormatAnnotationFormatterFactory;
363+
 import org.springframework.util.ClassUtils;
364+
 import org.springframework.util.StringValueResolver;
365+
@@ -104,13 +101,6 @@ public class DefaultFormattingConversionService extends FormattingConversionServ
366+
 		// Default handling of number values
367+
 		formatterRegistry.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
368+
 
369+
-		// Default handling of monetary values
370+
-		if (jsr354Present) {
371+
-			formatterRegistry.addFormatter(new CurrencyUnitFormatter());
372+
-			formatterRegistry.addFormatter(new MonetaryAmountFormatter());
373+
-			formatterRegistry.addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory());
374+
-		}
375+
-
376+
 		// Default handling of date-time values
377+
 		if (jsr310Present) {
378+
 			// just handling JSR-310 specific date and time types
320379
-- 
321380
2.18.0
322381

more/packages/geo.scm

2828
  #:use-module (gnu packages boost)
2929
  #:use-module (gnu packages compression)
3030
  #:use-module (gnu packages databases)
31+
  #:use-module (gnu packages datastructures)
32+
  #:use-module (gnu packages documentation)
3133
  #:use-module (gnu packages geo)
3234
  #:use-module (gnu packages image)
3335
  #:use-module (gnu packages lua)

6769
delivered to any client.")
6870
    (license license:expat)))
6971
72+
(define-public protozero
73+
  (package
74+
    (name "protozero")
75+
    (version "1.6.3")
76+
    (source
77+
      (origin
78+
        (method url-fetch)
79+
        (uri (string-append "https://github.com/mapbox/protozero/archive/v"
80+
			    version ".tar.gz"))
81+
	(file-name (string-append name "-" version ".tar.gz"))
82+
        (sha256
83+
         (base32
84+
          "1xaj4phz1r7xn0vgdfvfkz8b0bizgb6mavjky1zqcvdmbwgwgly5"))))
85+
    (build-system cmake-build-system)
86+
    (home-page "https://github.com/mapbox/protozero")
87+
    (synopsis "Minimalistic protocol buffer decoder and encoder in C++")
88+
    (description "Protozero is a minimalistic protocol buffer decored and
89+
encoder in C++.  The developer using protozero has to manually translate the
90+
@file{.proto} description into code.")
91+
    (license (list
92+
	       license:asl2.0; for folly
93+
	       license:bsd-2))))
94+
95+
(define-public libosmium
96+
  (package
97+
    (name "libosmium")
98+
    (version "2.14.2")
99+
    (source
100+
      (origin
101+
        (method url-fetch)
102+
        (uri (string-append "https://github.com/osmcode/libosmium/archive/v"
103+
			    version ".tar.gz"))
104+
	(file-name (string-append name "-" version ".tar.gz"))
105+
        (sha256
106+
         (base32
107+
          "0d9b46qiw7zkw1h9lygjdwqxnbhm3c7v8kydzw9f9f778cyagc94"))))
108+
    (build-system cmake-build-system)
109+
    (inputs
110+
     `(("boost" ,boost)
111+
       ("expat" ,expat)
112+
       ("gdal" ,gdal)
113+
       ("geos" ,geos)
114+
       ("proj.4" ,proj.4)
115+
       ("protozero" ,protozero)
116+
       ("sparsehash" ,sparsehash)
117+
       ("zlib" ,zlib)))
118+
    (native-inputs
119+
     `(("doxygen" ,doxygen)))
120+
    (home-page "https://osmcode.org/libosmium")
121+
    (synopsis "C++ library for working with OpenStreetMap data")
122+
    (description "Libosmium is a fast and flexible C++ library for working with
123+
OpenStreetMap data.")
124+
    (license license:boost1.0)))
125+
70126
(define-public imposm3
71127
  (package
72128
    (name "imposm3")

146202
                "08y7776r4l9v9177a4q6cfdri0lpirky96m6g699hwl7v1vhw0mn"))))
147203
    (build-system cmake-build-system)
148204
    (arguments
149-
      ;; failure :/
205+
      ;; failure
150206
     `(#:tests? #f))
151207
    (inputs
152208
     `(("boost" ,boost)

more/packages/java.scm

12541254
(define-public java-josm
12551255
  (package
12561256
    (name "java-josm")
1257-
    (version "14066")
1257+
    (version "14178")
12581258
    (source (origin
12591259
              (method svn-fetch)
12601260
              (uri (svn-reference

12621262
                    (revision (string->number version))))
12631263
              (sha256
12641264
               (base32
1265-
                "1kf7cr80n2y9dwjabn8l9r5n64kjf8vk0ial1fzc870gg785s7cw"))
1265+
                "1k03g6kxzs8gwswc48cgx6m689sssg73m1yfjdqc8zsky75fmz2d"))
12661266
              (file-name (string-append name "-" version))
12671267
              (modules '((guix build utils)))
12681268
              (snippet

58205820
    (native-inputs
58215821
     `(("icedtea-8" ,icedtea-8)
58225822
       ("icedtea-8:jdk" ,icedtea-8 "jdk")
5823-
       ("gcc" ,gcc)
58245823
       ("unzip" ,unzip)
58255824
       ("which" ,which)
58265825
       ("zip" ,zip)))