Skip to content

Commit e1678b5

Browse files
committed
IN PROGRESS - issue JAVAMONEY-8: Examples
https://java.net/jira/browse/JAVAMONEY-8
1 parent e8ad067 commit e1678b5

File tree

10 files changed

+87
-13
lines changed

10 files changed

+87
-13
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
javamoney-examples
22
==================
33

4-
JSR 354 Examples
4+
JSR 354 Examples
5+
6+
The current project structure is as follows:
7+
8+
---------
9+
* console: Console examples
10+
* javafx: JavaFX examples
11+
** money-fxdemo: JavaFX Demo application
12+
** money-javafx-binding: JavaFX binding examples
13+
* web: Web examples
14+
** javamoney-payment-cdi-event: Demo for CDI 1.0 Events with the Money and Currency API

console/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/.settings
3+
/.classpath
4+
/.project

console/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>org.javamoney</groupId>
5+
<artifactId>javamoney-examples</artifactId>
6+
<version>0.6-SNAPSHOT</version>
7+
</parent>
8+
<artifactId>javamoney-examples-console</artifactId>
9+
10+
<dependencies>
11+
<dependency>
12+
<groupId>org.slf4j</groupId>
13+
<artifactId>slf4j-api</artifactId>
14+
</dependency>
15+
16+
<dependency>
17+
<groupId>org.slf4j</groupId>
18+
<artifactId>jul-to-slf4j</artifactId>
19+
</dependency>
20+
21+
<dependency>
22+
<groupId>net.java.javamoney</groupId>
23+
<artifactId>money-ri</artifactId>
24+
<version>${javamoney.ri.version}</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>net.java.javamoney</groupId>
28+
<artifactId>money-java-se</artifactId>
29+
<version>${javamoney.ri.version}</version>
30+
</dependency>
31+
32+
</dependencies>
33+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
*
3+
*/
4+
package org.javamoney.examples.console;
5+
6+
import javax.money.Money;
7+
8+
import net.java.javamoney.ri.IntegralMoney;
9+
10+
/**
11+
* @author Werner Keil
12+
*
13+
*/
14+
public class IntegralDemo {
15+
16+
/**
17+
* @param args
18+
*/
19+
public static void main(String[] args) {
20+
Money amt1 = Money.of("USD", 10.1234556123456789);
21+
IntegralMoney amt2 = IntegralMoney.of("USD", 123456789);
22+
Money total = amt1.add(amt2);
23+
System.out.println(total);
24+
}
25+
26+
}

javafx/money-fxdemo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.javamoney</groupId>
77
<artifactId>javamoney-examples-javafx</artifactId>
8-
<version>0.5-SNAPSHOT</version>
8+
<version>0.6-SNAPSHOT</version>
99
</parent>
1010

1111

javafx/money-fxdemo/src/main/java/net/java/javamoney/fxdemo/exchange/ConvertAmount.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import net.java.javamoney.fxdemo.widgets.AmountEntry;
2323
import net.java.javamoney.fxdemo.widgets.CurrencySelector;
2424
import net.java.javamoney.fxdemo.widgets.ExchangeRateTypeSelector;
25-
import net.java.javamoney.ri.convert.provider.EZBConversionProvider;
25+
import net.java.javamoney.ri.convert.provider.EZBCurrentConversionProvider;
2626

2727
/**
2828
* @author Anatole Tresch
@@ -60,9 +60,9 @@ public void changed(
6060
+ (newERT !=null ? " New ERT: " + newERT : ""));
6161

6262
if (newERT != null) {
63-
if (EZBConversionProvider.RATE_TYPE.equals(newERT)) {
63+
if (EZBCurrentConversionProvider.RATE_TYPE.equals(newERT)) {
6464
logger.debug("got ECB");
65-
amountBox.getCodeBox().setValue(EZBConversionProvider.BASE_CURRENCY.getCurrencyCode());
65+
amountBox.getCodeBox().setValue(EZBCurrentConversionProvider.BASE_CURRENCY.getCurrencyCode());
6666
amountBox.getCodeBox().setDisable(true);
6767
} else {
6868
amountBox.getCodeBox().setDisable(false);

javafx/money-fxdemo/src/main/java/net/java/javamoney/fxdemo/exchange/GetExchangeRate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import net.java.javamoney.fxdemo.widgets.AbstractSingleSamplePane;
2222
import net.java.javamoney.fxdemo.widgets.CurrencySelector;
2323
import net.java.javamoney.fxdemo.widgets.ExchangeRateTypeSelector;
24-
import net.java.javamoney.ri.convert.provider.EZBConversionProvider;
24+
import net.java.javamoney.ri.convert.provider.EZBCurrentConversionProvider;
2525

2626
/**
2727
* @author Werner Keil
@@ -61,9 +61,9 @@ public void changed(
6161
+ (newERT !=null ? " New ERT: " + newERT : ""));
6262

6363
if (newERT != null) {
64-
if (EZBConversionProvider.RATE_TYPE.equals(newERT)) {
64+
if (EZBCurrentConversionProvider.RATE_TYPE.equals(newERT)) {
6565
logger.debug("got ECB");
66-
currencySelector1.setCurrency(EZBConversionProvider.BASE_CURRENCY);
66+
currencySelector1.setCurrency(EZBCurrentConversionProvider.BASE_CURRENCY);
6767
currencySelector1.setDisable(true);
6868
swapButton.setDisable(true);
6969
} else {

javafx/money-javafx-binding/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>javamoney-examples-javafx</artifactId>
88
<groupId>org.javamoney</groupId>
9-
<version>0.5-SNAPSHOT</version>
9+
<version>0.6-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>money-javafx-binding</artifactId>

javafx/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>javamoney-examples</artifactId>
55
<groupId>org.javamoney</groupId>
6-
<version>0.5-SNAPSHOT</version>
6+
<version>0.6-SNAPSHOT</version>
77
<relativePath>..</relativePath>
88
</parent>
99
<artifactId>javamoney-examples-javafx</artifactId>

pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.javamoney</groupId>
55
<artifactId>javamoney-examples</artifactId>
6-
<version>0.5-SNAPSHOT</version>
6+
<version>0.6-SNAPSHOT</version>
77
<packaging>pom</packaging>
88
<name>Java Money and Currency Examples</name>
99
<modules>
1010
<module>web</module>
1111
<!-- module>javafx</module -->
1212
<!-- TODO add profiles for Java 8/FX -->
13+
<module>console</module>
1314
</modules>
1415
<properties>
1516
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -21,8 +22,8 @@
2122
<junit.version>4.8.2</junit.version>
2223
<slf4j.version>1.6.1</slf4j.version>
2324
<!-- JSR versions -->
24-
<javamoney.version>0.5-SNAPSHOT</javamoney.version>
25-
<javamoney.ri.version>0.5-SNAPSHOT</javamoney.ri.version>
25+
<javamoney.version>0.6-SNAPSHOT</javamoney.version>
26+
<javamoney.ri.version>0.6-SNAPSHOT</javamoney.ri.version>
2627
</properties>
2728
<dependencyManagement>
2829
<dependencies>

0 commit comments

Comments
 (0)