Showing
6 changed files
with
65 additions
and
109 deletions
@@ -27,11 +27,11 @@ public class Updater { | @@ -27,11 +27,11 @@ public class Updater { | ||
27 | 27 | ||
28 | public ExchangeRateTable getRecentExchangeTable() throws IOException, YarfrawException, JAXBException { | 28 | public ExchangeRateTable getRecentExchangeTable() throws IOException, YarfrawException, JAXBException { |
29 | final List<ChannelFeed> feedList = FeedReaderUtils.readAll(Executors.newCachedThreadPool(), new HttpURL(feedURL)); | 29 | final List<ChannelFeed> feedList = FeedReaderUtils.readAll(Executors.newCachedThreadPool(), new HttpURL(feedURL)); |
30 | - if(feedList.size() < 1) { | 30 | + if (feedList.size() < 1) { |
31 | throw new IllegalArgumentException("Read 0 feeds."); | 31 | throw new IllegalArgumentException("Read 0 feeds."); |
32 | } | 32 | } |
33 | final List<ItemEntry> entries = feedList.get(0).getItems(); | 33 | final List<ItemEntry> entries = feedList.get(0).getItems(); |
34 | - if(entries.size() < 1) { | 34 | + if (entries.size() < 1) { |
35 | return null; | 35 | return null; |
36 | } | 36 | } |
37 | return ExchangeRateTableUnmarshaller.unmarshal(entries.get(0).getEnclosure().getUrl()); | 37 | return ExchangeRateTableUnmarshaller.unmarshal(entries.get(0).getEnclosure().getUrl()); |
@@ -5,6 +5,6 @@ import java.math.BigDecimal; | @@ -5,6 +5,6 @@ import java.math.BigDecimal; | ||
5 | public class RateConverter { | 5 | public class RateConverter { |
6 | 6 | ||
7 | public static BigDecimal convert(String value) { | 7 | public static BigDecimal convert(String value) { |
8 | - return new BigDecimal(value.replaceAll(",",".")); | 8 | + return new BigDecimal(value.replaceAll(",", ".")); |
9 | } | 9 | } |
10 | } | 10 | } |
@@ -5,16 +5,13 @@ | @@ -5,16 +5,13 @@ | ||
5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT | 5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT |
6 | // | 6 | // |
7 | 7 | ||
8 | - | ||
9 | package pl.labno.bernard.nbp.exchangerate.rest.generated; | 8 | package pl.labno.bernard.nbp.exchangerate.rest.generated; |
10 | 9 | ||
11 | -import java.math.BigDecimal; | ||
12 | import javax.xml.bind.annotation.adapters.XmlAdapter; | 10 | import javax.xml.bind.annotation.adapters.XmlAdapter; |
11 | +import java.math.BigDecimal; | ||
13 | 12 | ||
14 | public class Adapter1 | 13 | public class Adapter1 |
15 | - extends XmlAdapter<String, BigDecimal> | ||
16 | -{ | ||
17 | - | 14 | + extends XmlAdapter<String, BigDecimal> { |
18 | 15 | ||
19 | public BigDecimal unmarshal(String value) { | 16 | public BigDecimal unmarshal(String value) { |
20 | return (pl.labno.bernard.nbp.exchangerate.rest.RateConverter.convert(value)); | 17 | return (pl.labno.bernard.nbp.exchangerate.rest.RateConverter.convert(value)); |
@@ -5,24 +5,22 @@ | @@ -5,24 +5,22 @@ | ||
5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT | 5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT |
6 | // | 6 | // |
7 | 7 | ||
8 | - | ||
9 | package pl.labno.bernard.nbp.exchangerate.rest.generated; | 8 | package pl.labno.bernard.nbp.exchangerate.rest.generated; |
10 | 9 | ||
11 | -import java.math.BigDecimal; | ||
12 | -import java.math.BigInteger; | ||
13 | import javax.xml.bind.annotation.XmlAccessType; | 10 | import javax.xml.bind.annotation.XmlAccessType; |
14 | import javax.xml.bind.annotation.XmlAccessorType; | 11 | import javax.xml.bind.annotation.XmlAccessorType; |
15 | import javax.xml.bind.annotation.XmlElement; | 12 | import javax.xml.bind.annotation.XmlElement; |
16 | import javax.xml.bind.annotation.XmlSchemaType; | 13 | import javax.xml.bind.annotation.XmlSchemaType; |
17 | import javax.xml.bind.annotation.XmlType; | 14 | import javax.xml.bind.annotation.XmlType; |
18 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | 15 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
19 | - | 16 | +import java.math.BigDecimal; |
17 | +import java.math.BigInteger; | ||
20 | 18 | ||
21 | /** | 19 | /** |
22 | * <p>Java class for anonymous complex type. | 20 | * <p>Java class for anonymous complex type. |
23 | - * | 21 | + * <p/> |
24 | * <p>The following schema fragment specifies the expected content contained within this class. | 22 | * <p>The following schema fragment specifies the expected content contained within this class. |
25 | - * | 23 | + * <p/> |
26 | * <pre> | 24 | * <pre> |
27 | * <complexType> | 25 | * <complexType> |
28 | * <complexContent> | 26 | * <complexContent> |
@@ -37,8 +35,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | @@ -37,8 +35,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | ||
37 | * </complexContent> | 35 | * </complexContent> |
38 | * </complexType> | 36 | * </complexType> |
39 | * </pre> | 37 | * </pre> |
40 | - * | ||
41 | - * | ||
42 | */ | 38 | */ |
43 | @XmlAccessorType(XmlAccessType.FIELD) | 39 | @XmlAccessorType(XmlAccessType.FIELD) |
44 | @XmlType(name = "", propOrder = { | 40 | @XmlType(name = "", propOrder = { |
@@ -56,17 +52,15 @@ public class ExchangeRate { | @@ -56,17 +52,15 @@ public class ExchangeRate { | ||
56 | @XmlElement(name = "kod_waluty", required = true) | 52 | @XmlElement(name = "kod_waluty", required = true) |
57 | protected String currencySymbol; | 53 | protected String currencySymbol; |
58 | @XmlElement(name = "kurs_sredni", required = true, type = String.class) | 54 | @XmlElement(name = "kurs_sredni", required = true, type = String.class) |
59 | - @XmlJavaTypeAdapter(Adapter1 .class) | 55 | + @XmlJavaTypeAdapter(Adapter1.class) |
60 | @XmlSchemaType(name = "float") | 56 | @XmlSchemaType(name = "float") |
61 | protected BigDecimal value; | 57 | protected BigDecimal value; |
62 | 58 | ||
63 | /** | 59 | /** |
64 | * Gets the value of the currencyName property. | 60 | * Gets the value of the currencyName property. |
65 | - * | ||
66 | - * @return | ||
67 | - * possible object is | ||
68 | - * {@link String } | ||
69 | - * | 61 | + * |
62 | + * @return possible object is | ||
63 | + * {@link String } | ||
70 | */ | 64 | */ |
71 | public String getCurrencyName() { | 65 | public String getCurrencyName() { |
72 | return currencyName; | 66 | return currencyName; |
@@ -74,11 +68,9 @@ public class ExchangeRate { | @@ -74,11 +68,9 @@ public class ExchangeRate { | ||
74 | 68 | ||
75 | /** | 69 | /** |
76 | * Sets the value of the currencyName property. | 70 | * Sets the value of the currencyName property. |
77 | - * | ||
78 | - * @param value | ||
79 | - * allowed object is | ||
80 | - * {@link String } | ||
81 | - * | 71 | + * |
72 | + * @param value allowed object is | ||
73 | + * {@link String } | ||
82 | */ | 74 | */ |
83 | public void setCurrencyName(String value) { | 75 | public void setCurrencyName(String value) { |
84 | this.currencyName = value; | 76 | this.currencyName = value; |
@@ -86,11 +78,9 @@ public class ExchangeRate { | @@ -86,11 +78,9 @@ public class ExchangeRate { | ||
86 | 78 | ||
87 | /** | 79 | /** |
88 | * Gets the value of the przelicznik property. | 80 | * Gets the value of the przelicznik property. |
89 | - * | ||
90 | - * @return | ||
91 | - * possible object is | ||
92 | - * {@link BigInteger } | ||
93 | - * | 81 | + * |
82 | + * @return possible object is | ||
83 | + * {@link BigInteger } | ||
94 | */ | 84 | */ |
95 | public BigInteger getPrzelicznik() { | 85 | public BigInteger getPrzelicznik() { |
96 | return przelicznik; | 86 | return przelicznik; |
@@ -98,11 +88,9 @@ public class ExchangeRate { | @@ -98,11 +88,9 @@ public class ExchangeRate { | ||
98 | 88 | ||
99 | /** | 89 | /** |
100 | * Sets the value of the przelicznik property. | 90 | * Sets the value of the przelicznik property. |
101 | - * | ||
102 | - * @param value | ||
103 | - * allowed object is | ||
104 | - * {@link BigInteger } | ||
105 | - * | 91 | + * |
92 | + * @param value allowed object is | ||
93 | + * {@link BigInteger } | ||
106 | */ | 94 | */ |
107 | public void setPrzelicznik(BigInteger value) { | 95 | public void setPrzelicznik(BigInteger value) { |
108 | this.przelicznik = value; | 96 | this.przelicznik = value; |
@@ -110,11 +98,9 @@ public class ExchangeRate { | @@ -110,11 +98,9 @@ public class ExchangeRate { | ||
110 | 98 | ||
111 | /** | 99 | /** |
112 | * Gets the value of the currencySymbol property. | 100 | * Gets the value of the currencySymbol property. |
113 | - * | ||
114 | - * @return | ||
115 | - * possible object is | ||
116 | - * {@link String } | ||
117 | - * | 101 | + * |
102 | + * @return possible object is | ||
103 | + * {@link String } | ||
118 | */ | 104 | */ |
119 | public String getCurrencySymbol() { | 105 | public String getCurrencySymbol() { |
120 | return currencySymbol; | 106 | return currencySymbol; |
@@ -122,11 +108,9 @@ public class ExchangeRate { | @@ -122,11 +108,9 @@ public class ExchangeRate { | ||
122 | 108 | ||
123 | /** | 109 | /** |
124 | * Sets the value of the currencySymbol property. | 110 | * Sets the value of the currencySymbol property. |
125 | - * | ||
126 | - * @param value | ||
127 | - * allowed object is | ||
128 | - * {@link String } | ||
129 | - * | 111 | + * |
112 | + * @param value allowed object is | ||
113 | + * {@link String } | ||
130 | */ | 114 | */ |
131 | public void setCurrencySymbol(String value) { | 115 | public void setCurrencySymbol(String value) { |
132 | this.currencySymbol = value; | 116 | this.currencySymbol = value; |
@@ -134,11 +118,9 @@ public class ExchangeRate { | @@ -134,11 +118,9 @@ public class ExchangeRate { | ||
134 | 118 | ||
135 | /** | 119 | /** |
136 | * Gets the value of the value property. | 120 | * Gets the value of the value property. |
137 | - * | ||
138 | - * @return | ||
139 | - * possible object is | ||
140 | - * {@link String } | ||
141 | - * | 121 | + * |
122 | + * @return possible object is | ||
123 | + * {@link String } | ||
142 | */ | 124 | */ |
143 | public BigDecimal getValue() { | 125 | public BigDecimal getValue() { |
144 | return value; | 126 | return value; |
@@ -146,11 +128,9 @@ public class ExchangeRate { | @@ -146,11 +128,9 @@ public class ExchangeRate { | ||
146 | 128 | ||
147 | /** | 129 | /** |
148 | * Sets the value of the value property. | 130 | * Sets the value of the value property. |
149 | - * | ||
150 | - * @param value | ||
151 | - * allowed object is | ||
152 | - * {@link String } | ||
153 | - * | 131 | + * |
132 | + * @param value allowed object is | ||
133 | + * {@link String } | ||
154 | */ | 134 | */ |
155 | public void setValue(BigDecimal value) { | 135 | public void setValue(BigDecimal value) { |
156 | this.value = value; | 136 | this.value = value; |
@@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT | 5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT |
6 | // | 6 | // |
7 | 7 | ||
8 | - | ||
9 | package pl.labno.bernard.nbp.exchangerate.rest.generated; | 8 | package pl.labno.bernard.nbp.exchangerate.rest.generated; |
10 | 9 | ||
11 | import javax.xml.bind.annotation.XmlAccessType; | 10 | import javax.xml.bind.annotation.XmlAccessType; |
@@ -16,12 +15,11 @@ import javax.xml.bind.annotation.XmlType; | @@ -16,12 +15,11 @@ import javax.xml.bind.annotation.XmlType; | ||
16 | import java.util.ArrayList; | 15 | import java.util.ArrayList; |
17 | import java.util.List; | 16 | import java.util.List; |
18 | 17 | ||
19 | - | ||
20 | /** | 18 | /** |
21 | * <p>Java class for tabela_kursow element declaration. | 19 | * <p>Java class for tabela_kursow element declaration. |
22 | - * | 20 | + * <p/> |
23 | * <p>The following schema fragment specifies the expected content contained within this class. | 21 | * <p>The following schema fragment specifies the expected content contained within this class. |
24 | - * | 22 | + * <p/> |
25 | * <pre> | 23 | * <pre> |
26 | * <element name="tabela_kursow"> | 24 | * <element name="tabela_kursow"> |
27 | * <complexType> | 25 | * <complexType> |
@@ -50,8 +48,6 @@ import java.util.List; | @@ -50,8 +48,6 @@ import java.util.List; | ||
50 | * </complexType> | 48 | * </complexType> |
51 | * </element> | 49 | * </element> |
52 | * </pre> | 50 | * </pre> |
53 | - * | ||
54 | - * | ||
55 | */ | 51 | */ |
56 | @XmlAccessorType(XmlAccessType.FIELD) | 52 | @XmlAccessorType(XmlAccessType.FIELD) |
57 | @XmlType(name = "", propOrder = { | 53 | @XmlType(name = "", propOrder = { |
@@ -71,11 +67,9 @@ public class ExchangeRateTable { | @@ -71,11 +67,9 @@ public class ExchangeRateTable { | ||
71 | 67 | ||
72 | /** | 68 | /** |
73 | * Gets the value of the number property. | 69 | * Gets the value of the number property. |
74 | - * | ||
75 | - * @return | ||
76 | - * possible object is | ||
77 | - * {@link String } | ||
78 | - * | 70 | + * |
71 | + * @return possible object is | ||
72 | + * {@link String } | ||
79 | */ | 73 | */ |
80 | public String getNumber() { | 74 | public String getNumber() { |
81 | return number; | 75 | return number; |
@@ -83,11 +77,9 @@ public class ExchangeRateTable { | @@ -83,11 +77,9 @@ public class ExchangeRateTable { | ||
83 | 77 | ||
84 | /** | 78 | /** |
85 | * Sets the value of the number property. | 79 | * Sets the value of the number property. |
86 | - * | ||
87 | - * @param value | ||
88 | - * allowed object is | ||
89 | - * {@link String } | ||
90 | - * | 80 | + * |
81 | + * @param value allowed object is | ||
82 | + * {@link String } | ||
91 | */ | 83 | */ |
92 | public void setNumber(String value) { | 84 | public void setNumber(String value) { |
93 | this.number = value; | 85 | this.number = value; |
@@ -95,11 +87,9 @@ public class ExchangeRateTable { | @@ -95,11 +87,9 @@ public class ExchangeRateTable { | ||
95 | 87 | ||
96 | /** | 88 | /** |
97 | * Gets the value of the publicationDate property. | 89 | * Gets the value of the publicationDate property. |
98 | - * | ||
99 | - * @return | ||
100 | - * possible object is | ||
101 | - * {@link String } | ||
102 | - * | 90 | + * |
91 | + * @return possible object is | ||
92 | + * {@link String } | ||
103 | */ | 93 | */ |
104 | public String getPublicationDate() { | 94 | public String getPublicationDate() { |
105 | return publicationDate; | 95 | return publicationDate; |
@@ -107,11 +97,9 @@ public class ExchangeRateTable { | @@ -107,11 +97,9 @@ public class ExchangeRateTable { | ||
107 | 97 | ||
108 | /** | 98 | /** |
109 | * Sets the value of the publicationDate property. | 99 | * Sets the value of the publicationDate property. |
110 | - * | ||
111 | - * @param value | ||
112 | - * allowed object is | ||
113 | - * {@link String } | ||
114 | - * | 100 | + * |
101 | + * @param value allowed object is | ||
102 | + * {@link String } | ||
115 | */ | 103 | */ |
116 | public void setPublicationDate(String value) { | 104 | public void setPublicationDate(String value) { |
117 | this.publicationDate = value; | 105 | this.publicationDate = value; |
@@ -119,25 +107,23 @@ public class ExchangeRateTable { | @@ -119,25 +107,23 @@ public class ExchangeRateTable { | ||
119 | 107 | ||
120 | /** | 108 | /** |
121 | * Gets the value of the items property. | 109 | * Gets the value of the items property. |
122 | - * | ||
123 | - * <p> | 110 | + * <p/> |
111 | + * <p/> | ||
124 | * This accessor method returns a reference to the live list, | 112 | * This accessor method returns a reference to the live list, |
125 | * not a snapshot. Therefore any modification you make to the | 113 | * not a snapshot. Therefore any modification you make to the |
126 | * returned list will be present inside the JAXB object. | 114 | * returned list will be present inside the JAXB object. |
127 | * This is why there is not a <CODE>set</CODE> method for the items property. | 115 | * This is why there is not a <CODE>set</CODE> method for the items property. |
128 | - * | ||
129 | - * <p> | 116 | + * <p/> |
117 | + * <p/> | ||
130 | * For example, to add a new item, do as follows: | 118 | * For example, to add a new item, do as follows: |
131 | * <pre> | 119 | * <pre> |
132 | * getItems().add(newItem); | 120 | * getItems().add(newItem); |
133 | * </pre> | 121 | * </pre> |
134 | - * | ||
135 | - * | ||
136 | - * <p> | 122 | + * <p/> |
123 | + * <p/> | ||
124 | + * <p/> | ||
137 | * Objects of the following type(s) are allowed in the list | 125 | * Objects of the following type(s) are allowed in the list |
138 | * {@link ExchangeRate } | 126 | * {@link ExchangeRate } |
139 | - * | ||
140 | - * | ||
141 | */ | 127 | */ |
142 | public List<ExchangeRate> getItems() { | 128 | public List<ExchangeRate> getItems() { |
143 | if (items == null) { | 129 | if (items == null) { |
@@ -5,40 +5,34 @@ | @@ -5,40 +5,34 @@ | ||
5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT | 5 | // Generated on: 2010.12.16 at 02:23:57 PM GMT |
6 | // | 6 | // |
7 | 7 | ||
8 | - | ||
9 | package pl.labno.bernard.nbp.exchangerate.rest.generated; | 8 | package pl.labno.bernard.nbp.exchangerate.rest.generated; |
10 | 9 | ||
11 | import javax.xml.bind.annotation.XmlRegistry; | 10 | import javax.xml.bind.annotation.XmlRegistry; |
12 | 11 | ||
13 | - | ||
14 | /** | 12 | /** |
15 | - * This object contains factory methods for each | ||
16 | - * Java content interface and Java element interface | ||
17 | - * generated in the pl.labno.bernard.nbp.exchangerate.rest.generated package. | ||
18 | - * <p>An ObjectFactory allows you to programatically | ||
19 | - * construct new instances of the Java representation | ||
20 | - * for XML content. The Java representation of XML | ||
21 | - * content can consist of schema derived interfaces | ||
22 | - * and classes representing the binding of schema | ||
23 | - * type definitions, element declarations and model | ||
24 | - * groups. Factory methods for each of these are | 13 | + * This object contains factory methods for each |
14 | + * Java content interface and Java element interface | ||
15 | + * generated in the pl.labno.bernard.nbp.exchangerate.rest.generated package. | ||
16 | + * <p>An ObjectFactory allows you to programatically | ||
17 | + * construct new instances of the Java representation | ||
18 | + * for XML content. The Java representation of XML | ||
19 | + * content can consist of schema derived interfaces | ||
20 | + * and classes representing the binding of schema | ||
21 | + * type definitions, element declarations and model | ||
22 | + * groups. Factory methods for each of these are | ||
25 | * provided in this class. | 23 | * provided in this class. |
26 | - * | ||
27 | */ | 24 | */ |
28 | @XmlRegistry | 25 | @XmlRegistry |
29 | public class ObjectFactory { | 26 | public class ObjectFactory { |
30 | 27 | ||
31 | - | ||
32 | /** | 28 | /** |
33 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.labno.bernard.nbp.exchangerate.rest.generated | 29 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.labno.bernard.nbp.exchangerate.rest.generated |
34 | - * | ||
35 | */ | 30 | */ |
36 | public ObjectFactory() { | 31 | public ObjectFactory() { |
37 | } | 32 | } |
38 | 33 | ||
39 | /** | 34 | /** |
40 | * Create an instance of {@link ExchangeRateTable } | 35 | * Create an instance of {@link ExchangeRateTable } |
41 | - * | ||
42 | */ | 36 | */ |
43 | public ExchangeRateTable createExchangeRateTable() { | 37 | public ExchangeRateTable createExchangeRateTable() { |
44 | return new ExchangeRateTable(); | 38 | return new ExchangeRateTable(); |
@@ -46,7 +40,6 @@ public class ObjectFactory { | @@ -46,7 +40,6 @@ public class ObjectFactory { | ||
46 | 40 | ||
47 | /** | 41 | /** |
48 | * Create an instance of {@link ExchangeRate } | 42 | * Create an instance of {@link ExchangeRate } |
49 | - * | ||
50 | */ | 43 | */ |
51 | public ExchangeRate createExchangeRate() { | 44 | public ExchangeRate createExchangeRate() { |
52 | return new ExchangeRate(); | 45 | return new ExchangeRate(); |
Please
register
or
login
to post a comment