Skip to content

Commit 0e6628f

Browse files
committed
1 parent 18c899a commit 0e6628f

File tree

9 files changed

+119
-328
lines changed

9 files changed

+119
-328
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright (c) 2012, 2020, Werner Keil and others by the @author tag.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
use this file except in compliance with the License. You may obtain a copy of
6+
the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
License for the specific language governing permissions and limitations under
14+
the License.
15+
*/
16+
module org.javamoney.examples.console.java10 {
17+
exports org.javamoney.examples.console.java10;
18+
19+
requires transitive java.money;
20+
requires org.javamoney.moneta;
21+
}

console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/AmountsDoCalculations.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* JavaMoney Examples
3-
* Copyright 2012-2018, Werner Keil
3+
* Copyright 2012-2020, Werner Keil
44
* and individual contributors by the @author tags.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +25,7 @@
2525

2626
/**
2727
* @author Werner Keil
28-
* @version 0.9
28+
* @version 1.0
2929
*/
3030
public class AmountsDoCalculations {
3131

@@ -51,5 +51,4 @@ public static void main(String[] args) {
5151
.remainder(1);
5252
ConsoleUtils.printDetails(total);
5353
}
54-
5554
}

console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/FormattingAmounts.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1+
/*
2+
* JavaMoney Examples
3+
* Copyright 2012-2020, Werner Keil
4+
* and individual contributors by the @author tags.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.javamoney.examples.console.java10;
217

318
import org.javamoney.moneta.Money;
419
import org.javamoney.moneta.format.AmountFormatParams;
520
import org.javamoney.moneta.format.CurrencyStyle;
621

7-
import javax.money.MonetaryAmount;
822
import javax.money.format.AmountFormatQueryBuilder;
923
import javax.money.format.MonetaryFormats;
1024
import java.util.Locale;
1125

1226
/**
13-
* Created by Anatole on 14.05.2015.
27+
* Created by Werner on 11.10.2019.
1428
*/
1529
public class FormattingAmounts {
1630

@@ -32,5 +46,4 @@ public static void main(String... args) {
3246
amt = Money.of(5, "USD");
3347
System.out.println(MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder.of(Locale.US).set(CurrencyStyle.SYMBOL).set(AmountFormatParams.PATTERN, "¤##.##").build()).format(amt));
3448
}
35-
3649
}
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
/*
2+
* JavaMoney Examples
3+
* Copyright 2012-2020, Werner Keil
4+
* and individual contributors by the @author tags.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.javamoney.examples.console.java10;
217

318
import java.util.Locale;
419

5-
import javax.money.MonetaryAmount;
6-
import javax.money.format.MonetaryAmountFormat;
720
import javax.money.format.MonetaryFormats;
821

922
import org.javamoney.moneta.Money;
@@ -16,19 +29,18 @@ public class FormattingLocaleDemo {
1629
public static void main(String[] args) {
1730
final String COMPARISON = "EUR 123,456.78";
1831

19-
MonetaryAmountFormat format = MonetaryFormats.getAmountFormat(Locale.ROOT);
32+
var format = MonetaryFormats.getAmountFormat(Locale.ROOT);
2033

21-
MonetaryAmount source = Money.of(123456.78, "EUR");
22-
String formatted = format.format(source);
34+
var source = Money.of(123456.78, "EUR");
35+
var formatted = format.format(source);
2336

2437
System.out.println(formatted); // "EUR 123,456.78", space is a 32 on JDK 8, a 160 on JDK 9 and 10
2538
System.out.println((int) formatted.toCharArray()[3]); // JDK 8: 32, JDK 9: 160, JDK 10: 160
2639

27-
MonetaryAmount result = format.parse(COMPARISON); // Space is char of 32 (standard space)
40+
var result = format.parse(COMPARISON); // Space is char of 32 (standard space)
2841
formatted = format.format(result);
2942
System.out.println(formatted);
3043
System.out.println(COMPARISON.equals(formatted));
3144
System.out.println(result.toString());
3245
}
33-
3446
}

console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/Person.java

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)