Permalink
Browse files

Updated build scripts and POMs

  • Loading branch information...
1 parent 1027e21 commit a47542aa218d502aded1fd3157a2f3cc926f65cc @keilw keilw committed Sep 23, 2013
View
16 buildJavaDoc.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project default="javadoc">
- <target name="javadoc">
- <javadoc access="protected" author="true" classpath="money-api/ext/target/classes;money-api/platform/target/test-classes;money-api/convert/target/classes;C:\Users\Anatole\.m2\repository\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;money-api/ext/target/test-classes;money-impl/platform/target/test-classes;C:\Users\Anatole\.m2\repository\org\slf4j\jul-to-slf4j\1.6.1\jul-to-slf4j-1.6.1.jar;money-api/platform/target/classes;C:\Users\Anatole\.m2\repository\junit\junit\4.8.2\junit-4.8.2.jar;C:\Users\Anatole\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;money-api/format/target/classes;money-api/convert/target/test-classes;money-api/format/target/test-classes" destdir="C:\Users\Anatole\Desktop\JSR 354 - Public Review API Docs" doctitle="JSR 354 - API and Platform RI JavaDoc" nodeprecated="true" nodeprecatedlist="true" noindex="false" nonavbar="false" notree="false" packagenames="javax.money.ext.spi,javax.money.format.spi,javax.money.convert.spi,javax.money.spi" source="1.7" sourcefiles="money-impl/platform/src/main/java/javax/money/function/MinorPart.java,money-api/convert/src/main/java/javax/money/convert/package-info.java,money-api/ext/src/main/java/javax/money/ext/Validities.java,money-impl/platform/src/main/java/javax/money/function/MoneyRoundings.java,money-impl/platform/src/main/java/javax/money/function/OrPredicate.java,money-impl/platform/src/main/java/javax/money/ConstraintMonetaryAmount.java,money-impl/platform/src/main/java/javax/money/function/Minimum.java,money-impl/platform/src/main/java/javax/money/function/Average.java,money-api/platform/src/main/java/javax/money/MonetaryAmount.java,money-impl/platform/src/main/java/javax/money/package-info.java,money-impl/platform/src/main/java/javax/money/function/ItemFilter.java,money-api/platform/src/main/java/javax/money/CurrencyUnit.java,money-api/platform/src/main/java/javax/money/Displayable.java,money-impl/platform/src/main/java/javax/money/function/MajorUnits.java,money-impl/platform/src/main/java/javax/money/function/Permil.java,money-impl/platform/src/main/java/javax/money/function/AndPredicate.java,money-impl/platform/src/main/java/javax/money/function/NotPredicate.java,money-api/platform/src/main/java/javax/money/UnknownCurrencyException.java,money-impl/platform/src/main/java/javax/money/function/MinCountPredicate.java,money-impl/platform/src/main/java/javax/money/function/Total.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConverter.java,money-impl/platform/src/main/java/javax/money/function/XOrPredicate.java,money-api/platform/src/main/java/javax/money/CurrencyMismatchException.java,money-api/platform/src/main/java/javax/money/MonetaryOperator.java,money-api/format/src/main/java/javax/money/format/ItemFormat.java,money-api/format/src/main/java/javax/money/format/LocalizationStyle.java,money-api/ext/src/main/java/javax/money/ext/ValidityInfo.java,money-api/format/src/main/java/javax/money/format/ItemFormatException.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConversionException.java,money-impl/platform/src/main/java/javax/money/MoneyCurrency.java,money-impl/platform/src/main/java/javax/money/function/MoneyFunctions.java,money-api/ext/src/main/java/javax/money/ext/RelatedValidityInfo.java,money-api/format/src/main/java/javax/money/format/FormatToken.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConversion.java,money-api/ext/src/main/java/javax/money/ext/MonetaryCurrencies.java,money-api/format/src/main/java/javax/money/format/ParseContext.java,money-impl/platform/src/main/java/javax/money/function/package-info.java,money-api/ext/src/main/java/javax/money/ext/Region.java,money-api/format/src/main/java/javax/money/format/MonetaryFormats.java,money-api/format/src/main/java/javax/money/format/package-info.java,money-api/format/src/main/java/javax/money/format/FormattableItem.java,money-impl/platform/src/main/java/javax/money/function/MonetaryPredicates.java,money-api/ext/src/main/java/javax/money/ext/RelatedValidityQuery.java,money-api/format/src/main/java/javax/money/format/ItemFormatBuilder.java,money-api/ext/src/main/java/javax/money/ext/Regions.java,money-impl/platform/src/main/java/javax/money/function/AmountCurrencyUnitPredicate.java,money-impl/platform/src/main/java/javax/money/function/Reciprocal.java,money-impl/platform/src/main/java/javax/money/function/DefaultCashRounding.java,money-impl/platform/src/main/java/javax/money/function/MajorPart.java,money-impl/platform/src/main/java/javax/money/function/IncludedPredicate.java,money-api/format/src/main/java/javax/money/format/ItemFactory.java,money-impl/platform/src/main/java/javax/money/function/MinorUnits.java,money-impl/platform/src/main/java/javax/money/function/MaxCountPredicate.java,money-api/ext/src/main/java/javax/money/ext/RegionTreeNode.java,money-api/platform/src/main/java/javax/money/package-info.java,money-api/format/src/main/java/javax/money/format/ItemParseException.java,money-api/platform/src/main/java/javax/money/Predicate.java,money-api/platform/src/main/java/javax/money/MonetaryException.java,money-api/platform/src/main/java/javax/money/CurrencyNamespace.java,money-api/platform/src/main/java/javax/money/MonetaryFunction.java,money-api/ext/src/main/java/javax/money/ext/ValidityQuery.java,money-impl/platform/src/main/java/javax/money/function/Percent.java,money-api/convert/src/main/java/javax/money/convert/ConversionProvider.java,money-api/ext/src/main/java/javax/money/ext/package-info.java,money-api/convert/src/main/java/javax/money/convert/ExchangeRate.java,money-impl/platform/src/main/java/javax/money/function/DefaultRounding.java,money-impl/platform/src/main/java/javax/money/function/Maximum.java,money-impl/platform/src/main/java/javax/money/Money.java,money-api/ext/src/main/java/javax/money/ext/RegionType.java,money-api/convert/src/main/java/javax/money/convert/ExchangeRateType.java,money-api/format/src/main/java/javax/money/format/DefaultItemFactory.java,money-impl/platform/src/main/java/javax/money/function/ItemVisitor.java,money-api/ext/src/main/java/javax/money/ext/ValidityType.java,money-api/format/src/main/java/javax/money/format/LiteralToken.java,money-impl/platform/src/main/java/javax/money/ConstraintAmount.java,money-api/convert/src/main/java/javax/money/convert/MonetaryConversions.java" sourcepath="money-api/convert/src/main/java;money-api/platform/src/test/java;money-api/platform/src/main/java;money-api/ext/src/test/resources;money-impl/platform/src/main/java;money-api/format/src/test/java;money-api/format/src/test/resources;money-api/format/src/main/java;money-api/ext/src/main/java;money-api/ext/src/test/java;money-impl/platform/src/test/java;money-api/convert/src/test/java;money-api/convert/src/test/resources" splitindex="true" use="true" version="true">
- <link href="http://download.oracle.com/javase/7/docs/api/"/>
- </javadoc>
- </target>
-</project>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project default="javadoc">
+ <target name="javadoc">
+ <javadoc access="protected" author="true" classpath="money-api/ext/target/classes;money-api/platform/target/test-classes;money-api/convert/target/classes;C:\Users\Anatole\.m2\repository\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;money-api/ext/target/test-classes;money-impl/platform/target/test-classes;C:\Users\Anatole\.m2\repository\org\slf4j\jul-to-slf4j\1.6.1\jul-to-slf4j-1.6.1.jar;money-api/platform/target/classes;C:\Users\Anatole\.m2\repository\junit\junit\4.8.2\junit-4.8.2.jar;C:\Users\Anatole\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;money-api/format/target/classes;money-api/convert/target/test-classes;money-api/format/target/test-classes" destdir="C:\Users\Anatole\Desktop\JSR 354 - Public Review API Docs" doctitle="JSR 354 - API and Platform RI JavaDoc" nodeprecated="true" nodeprecatedlist="true" noindex="false" nonavbar="false" notree="false" packagenames="javax.money.ext.spi,javax.money.format.spi,javax.money.convert.spi,javax.money.spi" source="1.7" sourcefiles="money-impl/platform/src/main/java/javax/money/function/MinorPart.java,money-api/convert/src/main/java/javax/money/convert/package-info.java,money-api/ext/src/main/java/javax/money/ext/Validities.java,money-impl/platform/src/main/java/javax/money/function/MoneyRoundings.java,money-impl/platform/src/main/java/javax/money/function/OrPredicate.java,money-impl/platform/src/main/java/javax/money/ConstraintMonetaryAmount.java,money-impl/platform/src/main/java/javax/money/function/Minimum.java,money-impl/platform/src/main/java/javax/money/function/Average.java,money-api/platform/src/main/java/javax/money/MonetaryAmount.java,money-impl/platform/src/main/java/javax/money/package-info.java,money-impl/platform/src/main/java/javax/money/function/ItemFilter.java,money-api/platform/src/main/java/javax/money/CurrencyUnit.java,money-api/platform/src/main/java/javax/money/Displayable.java,money-impl/platform/src/main/java/javax/money/function/MajorUnits.java,money-impl/platform/src/main/java/javax/money/function/Permil.java,money-impl/platform/src/main/java/javax/money/function/AndPredicate.java,money-impl/platform/src/main/java/javax/money/function/NotPredicate.java,money-api/platform/src/main/java/javax/money/UnknownCurrencyException.java,money-impl/platform/src/main/java/javax/money/function/MinCountPredicate.java,money-impl/platform/src/main/java/javax/money/function/Total.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConverter.java,money-impl/platform/src/main/java/javax/money/function/XOrPredicate.java,money-api/platform/src/main/java/javax/money/CurrencyMismatchException.java,money-api/platform/src/main/java/javax/money/MonetaryOperator.java,money-api/format/src/main/java/javax/money/format/ItemFormat.java,money-api/format/src/main/java/javax/money/format/LocalizationStyle.java,money-api/ext/src/main/java/javax/money/ext/ValidityInfo.java,money-api/format/src/main/java/javax/money/format/ItemFormatException.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConversionException.java,money-impl/platform/src/main/java/javax/money/MoneyCurrency.java,money-impl/platform/src/main/java/javax/money/function/MoneyFunctions.java,money-api/ext/src/main/java/javax/money/ext/RelatedValidityInfo.java,money-api/format/src/main/java/javax/money/format/FormatToken.java,money-api/convert/src/main/java/javax/money/convert/CurrencyConversion.java,money-api/ext/src/main/java/javax/money/ext/MonetaryCurrencies.java,money-api/format/src/main/java/javax/money/format/ParseContext.java,money-impl/platform/src/main/java/javax/money/function/package-info.java,money-api/ext/src/main/java/javax/money/ext/Region.java,money-api/format/src/main/java/javax/money/format/MonetaryFormats.java,money-api/format/src/main/java/javax/money/format/package-info.java,money-api/format/src/main/java/javax/money/format/FormattableItem.java,money-impl/platform/src/main/java/javax/money/function/MonetaryPredicates.java,money-api/ext/src/main/java/javax/money/ext/RelatedValidityQuery.java,money-api/format/src/main/java/javax/money/format/ItemFormatBuilder.java,money-api/ext/src/main/java/javax/money/ext/Regions.java,money-impl/platform/src/main/java/javax/money/function/AmountCurrencyUnitPredicate.java,money-impl/platform/src/main/java/javax/money/function/Reciprocal.java,money-impl/platform/src/main/java/javax/money/function/DefaultCashRounding.java,money-impl/platform/src/main/java/javax/money/function/MajorPart.java,money-impl/platform/src/main/java/javax/money/function/IncludedPredicate.java,money-api/format/src/main/java/javax/money/format/ItemFactory.java,money-impl/platform/src/main/java/javax/money/function/MinorUnits.java,money-impl/platform/src/main/java/javax/money/function/MaxCountPredicate.java,money-api/ext/src/main/java/javax/money/ext/RegionTreeNode.java,money-api/platform/src/main/java/javax/money/package-info.java,money-api/format/src/main/java/javax/money/format/ItemParseException.java,money-api/platform/src/main/java/javax/money/Predicate.java,money-api/platform/src/main/java/javax/money/MonetaryException.java,money-api/platform/src/main/java/javax/money/CurrencyNamespace.java,money-api/platform/src/main/java/javax/money/MonetaryFunction.java,money-api/ext/src/main/java/javax/money/ext/ValidityQuery.java,money-impl/platform/src/main/java/javax/money/function/Percent.java,money-api/convert/src/main/java/javax/money/convert/ConversionProvider.java,money-api/ext/src/main/java/javax/money/ext/package-info.java,money-api/convert/src/main/java/javax/money/convert/ExchangeRate.java,money-impl/platform/src/main/java/javax/money/function/DefaultRounding.java,money-impl/platform/src/main/java/javax/money/function/Maximum.java,money-impl/platform/src/main/java/javax/money/Money.java,money-api/ext/src/main/java/javax/money/ext/RegionType.java,money-api/convert/src/main/java/javax/money/convert/ExchangeRateType.java,money-api/format/src/main/java/javax/money/format/DefaultItemFactory.java,money-impl/platform/src/main/java/javax/money/function/ItemVisitor.java,money-api/ext/src/main/java/javax/money/ext/ValidityType.java,money-api/format/src/main/java/javax/money/format/LiteralToken.java,money-impl/platform/src/main/java/javax/money/ConstraintAmount.java,money-api/convert/src/main/java/javax/money/convert/MonetaryConversions.java" sourcepath="money-api/convert/src/main/java;money-api/platform/src/test/java;money-api/platform/src/main/java;money-api/ext/src/test/resources;money-impl/platform/src/main/java;money-api/format/src/test/java;money-api/format/src/test/resources;money-api/format/src/main/java;money-api/ext/src/main/java;money-api/ext/src/test/java;money-impl/platform/src/test/java;money-api/convert/src/test/java;money-api/convert/src/test/resources" splitindex="true" use="true" version="true">
+ <link href="http://download.oracle.com/javase/7/docs/api/"/>
+ </javadoc>
+ </target>
+</project>
View
278 money-api/convert/src/main/java/javax/money/convert/ExchangeRateType.java
@@ -1,139 +1,139 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money.convert;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * This class models the type of a given exchange rate as immutable value type.
- * Basically the types possible are determined by the concrete use cases and
- * implementations. Typical use cases is that exchange rates for different
- * credit card systems or debit/credit may differ. This class allows to
- * distinguish these rates and also provides access to the rate types used.
- *
- * @author Anatole Tresch
- */
-public final class ExchangeRateType implements Serializable,
- Comparable<ExchangeRateType> {
- /**
- * serialVersionUID.
- */
- private static final long serialVersionUID = -7505497771490888058L;
- /** The id of this type. */
- private final String id;
- /** The cache of types. */
- private static final Map<String, ExchangeRateType> CACHED_INSTANCES = new ConcurrentHashMap<String, ExchangeRateType>();
-
- /**
- * Creates a new instance.
- *
- * @param id
- * The rate identifier.
- * @return The new rate type.
- */
- public static ExchangeRateType of(String id) {
- if (id == null) {
- throw new IllegalArgumentException("id required.");
- }
- ExchangeRateType instance = CACHED_INSTANCES.get(id);
- if (instance == null) {
- instance = new ExchangeRateType(id);
- CACHED_INSTANCES.put(id, instance);
- }
- return instance;
- }
-
- /**
- * Constructs a new instance of an ExchangeRateType..
- *
- * @param id
- * The id of this type instance, never null.
- */
- public ExchangeRateType(String id) {
- if (id == null) {
- throw new IllegalArgumentException("Id must not be null.");
- }
- this.id = id;
- }
-
- /**
- * Get the identifier of this instance.
- *
- * @return The identifier, never null.
- */
- public String getId() {
- return this.id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ExchangeRateType other = (ExchangeRateType) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "ExchangeRateType [id=" + id + "]";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(ExchangeRateType o) {
- if (o == null) {
- return -1;
- }
- int compare = id.compareTo(o.id);
- return compare;
- }
-
-}
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money.convert;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * This class models the type of a given exchange rate as immutable value type.
+ * Basically the types possible are determined by the concrete use cases and
+ * implementations. Typical use cases is that exchange rates for different
+ * credit card systems or debit/credit may differ. This class allows to
+ * distinguish these rates and also provides access to the rate types used.
+ *
+ * @author Anatole Tresch
+ */
+public final class ExchangeRateType implements Serializable,
+ Comparable<ExchangeRateType> {
+ /**
+ * serialVersionUID.
+ */
+ private static final long serialVersionUID = -7505497771490888058L;
+ /** The id of this type. */
+ private final String id;
+ /** The cache of types. */
+ private static final Map<String, ExchangeRateType> CACHED_INSTANCES = new ConcurrentHashMap<String, ExchangeRateType>();
+
+ /**
+ * Creates a new instance.
+ *
+ * @param id
+ * The rate identifier.
+ * @return The new rate type.
+ */
+ public static ExchangeRateType of(String id) {
+ if (id == null) {
+ throw new IllegalArgumentException("id required.");
+ }
+ ExchangeRateType instance = CACHED_INSTANCES.get(id);
+ if (instance == null) {
+ instance = new ExchangeRateType(id);
+ CACHED_INSTANCES.put(id, instance);
+ }
+ return instance;
+ }
+
+ /**
+ * Constructs a new instance of an ExchangeRateType..
+ *
+ * @param id
+ * The id of this type instance, never null.
+ */
+ public ExchangeRateType(String id) {
+ if (id == null) {
+ throw new IllegalArgumentException("Id must not be null.");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Get the identifier of this instance.
+ *
+ * @return The identifier, never null.
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ExchangeRateType other = (ExchangeRateType) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ExchangeRateType [id=" + id + "]";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(ExchangeRateType o) {
+ if (o == null) {
+ return -1;
+ }
+ int compare = id.compareTo(o.id);
+ return compare;
+ }
+
+}
View
794 money-api/ext/src/main/java/javax/money/ext/ValidityQuery.java
@@ -1,397 +1,397 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money.ext;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import javax.money.ext.spi.ValidityProviderSpi;
-
-/**
- * For accessing {@link ValidityInfo} instances from the {@link Validities}
- * singleton, instances of this class must be created an configured.
- * <p>
- * This class and its subclasses should be immutable, thread-safe and
- * {@link Serializable}.
- * <p>
- * nOTE: The class and its builder are available for subclassing, since more
- * advanced queries may be created with them.
- *
- * @author Anatole Tresch
- *
- * @param <T>
- * the item type, on which validities are defined.
- */
-public class ValidityQuery<T> {
- /** The base item. */
- private T item;
- /** The base item. */
- private Class<T> itemType;
- /**
- * The starting UTC timestamp for the validity period, or null.
- */
- private Long from;
- /**
- * The ending UTC timestamp for the validity period, or null.
- */
- private Long to;
- /**
- * The source that provides this validity data.
- */
- private String validitySource;
-
- /**
- * The type of Validity, by default {@link ValidityType#EXISTENCE}.
- */
- private ValidityType validityType = ValidityType.EXISTENCE;
-
- /**
- * The target timezone id of this validity instance, allowing to restore the
- * correct local date.
- */
- private String targetTimezoneId;
-
- /**
- * Constructor.
- *
- * @param validityType
- * the validity type, not {@code null}.
- * @param itemType
- * the item type, not {@code null}.
- * @param item
- * the item constraint.
- * @param validitySource
- * the validity source id.
- * @param from
- * the starting UTC timestamp.
- * @param to
- * the ending UTC timestamp.
- * @param targetTimezoneId
- * the target timezone ID.
- */
- protected ValidityQuery(ValidityType validityType, Class<T> itemType,
- T item, String validitySource, Long from, Long to,
- String targetTimezoneId) {
- if (itemType == null) {
- throw new IllegalArgumentException("ItemClass required");
- }
- if (validityType == null) {
- throw new IllegalArgumentException("ValidityType required.");
- }
- this.validityType = validityType;
- this.itemType = itemType;
- this.validitySource = validitySource;
- this.from = from;
- this.targetTimezoneId = targetTimezoneId;
- this.item = item;
- this.to = to;
- }
-
- /**
- * Sets the {@link ValidityType} required, by default
- * {@link ValidityType#EXISTENCE} is used.
- *
- * @return the validity type used, not {@code null}.
- */
- public ValidityType getValidityType() {
- return this.validityType;
- }
-
- /**
- * Access the item class for which the validities are queried. It is also
- * possible query only for a related {@link Class} instance, which will
- * select all validities of all items of that type.<br/>
- * If {@link #item} was set, this method returns the class of {@link #item},
- * so implementors of {@link ValidityProviderSpi} must additionally
- * explicitly check, if {@link #getItem()} is returning any non {@code null}
- * value.
- *
- * @see #getRelatedToInstance()
- *
- * @return the item The item for which the validity information is queried.
- */
- public final Class<T> getItemType() {
- return itemType;
- }
-
- /**
- * Access the item for which the validities are queried. It is also possible
- * pass a {@link Class} instance here, which will select all validities of
- * all items of that type.
- *
- * @return the item The item for which the validity information is queried.
- */
- public final T getItem() {
- return item;
- }
-
- /**
- * Get the starting range, for which validities are queried.0
- *
- * @return the from timestamp, or {@code null].
-
- */
- public final Long getFrom() {
- return from;
- }
-
- /**
- * Get the ending range, for which validities are queried.0
- *
- * @return the to timestamp, or {@code null].
-
- */
- public final Long getTo() {
- return to;
- }
-
- /**
- * Get the validity source, thus effectively asking for information provided
- * by a specific source.
- *
- * @return the validitySource
- */
- public final String getValiditySource() {
- return validitySource;
- }
-
- /**
- * Get the target timezone Id, to be returned by the {@link Validities}
- * singleton.
- *
- * @return the targetTimezoneId
- */
- public final String getTargetTimezoneId() {
- return targetTimezoneId;
- }
-
- /**
- * Checks if no explicit time range was defined for the query.
- *
- * @return true, if both {@link #from} and {@link #to} are {@code null}.
- */
- public boolean isTimeUnbounded() {
- return from == null && to == null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "ValidityQuery [itemType=" + itemType + ", item=" + item
- + ", from=" + from + ", to=" + to
- + ", targetTimezoneId=" + targetTimezoneId
- + ", validitySource=" + validitySource + ", validityType="
- + validityType + "]";
- }
-
- /**
- * For accessing {@link ValidityInfo} instances from the {@link Validities}
- * singleton, instances of this class must be created an configured.
- * <p>
- * This class is immutable, thread-safe and {@link Serializable}.
- *
- * @author Anatole Tresch
- *
- * @param <T>
- * the item type, on which validities are defined.
- */
- public static class Builder<T> {
- /** The base item. */
- protected T item;
- /** The base item. */
- protected Class<T> itemType;
- /**
- * The starting UTC timestamp for the validity period, or null.
- */
- protected Long from;
- /**
- * The ending UTC timestamp for the validity period, or null.
- */
- protected Long to;
- /**
- * The source that provides this validity data.
- */
- protected String validitySource;
-
- /**
- * The type of Validity, by default {@link ValidityType#EXISTENCE}.
- */
- protected ValidityType validityType = ValidityType.EXISTENCE;
-
- /**
- * The target timezone id of this validity instance, allowing to restore
- * the correct local date.
- */
- protected String targetTimezoneId;
-
- /**
- * Creates a new validity query.
- *
- * @param validityType
- * The validity type.
- * @param itemClass
- * the type for which validities are queried.
- */
- public Builder(ValidityType validityType, Class<T> itemType) {
- if (validityType == null) {
- throw new IllegalArgumentException("validityType required");
- }
- this.validityType = validityType;
- }
-
- /**
- * Creates a new validity query.
- *
- * @param itemClass
- * the type for which validities are queried.
- */
- public Builder() {
- }
-
- /**
- * Builds a new {@link ValidityQuery}.
- *
- * @return the new query, never {@code null}.
- * @throws IllegalArgumentException
- * if the query could not be built.
- */
- public ValidityQuery<T> build() {
- return new ValidityQuery<T>(validityType, itemType, item,
- validitySource, from, to, targetTimezoneId);
- }
-
- /**
- * Sets the target item.
- *
- * @param item
- * the target item
- * @return the instance, for chaining.
- */
- public Builder<T> withItem(T item) {
- this.item = item;
- return this;
- }
-
- /**
- * Sets the target item type.
- *
- * @param item
- * the target item type, not {@code null}.
- * @return the instance, for chaining.
- */
- public Builder<T> withItemType(Class<T> itemType) {
- if (itemType == null) {
- throw new IllegalArgumentException("ItemClass required");
- }
- this.itemType = itemType;
- return this;
- }
-
- /**
- * Sets the target timezone ID.
- *
- * @param timezoneÎD
- * the target timezone ID
- * @return the instance, for chaining.
- */
- public Builder<T> withTargetTimezoneID(String timezoneÎD) {
- this.targetTimezoneId = timezoneÎD;
- return this;
- }
-
- /**
- * Sets the target timezone.
- *
- * @param timezone
- * the target timezone
- * @return the instance, for chaining.
- */
- public Builder<T> withTargetTimezone(TimeZone timezone) {
- this.targetTimezoneId = timezone.getID();
- return this;
- }
-
- /**
- * Sets the {@link #from} timestamp.
- *
- * @param timestamp
- * The from timestamp.
- * @return the instance, for chaining.
- */
- public Builder<T> withFrom(long timestamp) {
- this.from = timestamp;
- return this;
- }
-
- /**
- * Sets the {@link #to} timestamp.
- *
- * @param timestamp
- * The to timestamp.
- * @return the instance, for chaining.
- */
- public Builder<T> withTo(long timestamp) {
- this.to = timestamp;
- return this;
- }
-
- /**
- * Sets the validity provider to be queried. If not set all registered
- * and matching providers may return a result. The first non null result
- * is considered the final result in such a scenario.
- *
- * @param source
- * the source identifier
- * @return the instance, for chaining.
- */
- public Builder<T> withValiditySource(String source) {
- this.validitySource = source;
- return this;
- }
-
- /**
- * Sets the {@link ValidityType} required. It is also possible to pass
- * {@link ValidityType#ANY} to query all validities known for an item.
- *
- * @param validityType
- * @return
- */
- public Builder<T> withValidityType(
- ValidityType validityType) {
- if (validityType == null) {
- throw new IllegalArgumentException("ValidityType required.");
- }
- this.validityType = validityType;
- return this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "ValidityQuery.Builder [itemType=" + itemType + ", item="
- + item
- + ", from=" + from + ", to=" + to
- + ", targetTimezoneId=" + targetTimezoneId
- + ", validitySource=" + validitySource + ", validityType="
- + validityType + "]";
- }
-
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money.ext;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.money.ext.spi.ValidityProviderSpi;
+
+/**
+ * For accessing {@link ValidityInfo} instances from the {@link Validities}
+ * singleton, instances of this class must be created an configured.
+ * <p>
+ * This class and its subclasses should be immutable, thread-safe and
+ * {@link Serializable}.
+ * <p>
+ * nOTE: The class and its builder are available for subclassing, since more
+ * advanced queries may be created with them.
+ *
+ * @author Anatole Tresch
+ *
+ * @param <T>
+ * the item type, on which validities are defined.
+ */
+public class ValidityQuery<T> {
+ /** The base item. */
+ private T item;
+ /** The base item. */
+ private Class<T> itemType;
+ /**
+ * The starting UTC timestamp for the validity period, or null.
+ */
+ private Long from;
+ /**
+ * The ending UTC timestamp for the validity period, or null.
+ */
+ private Long to;
+ /**
+ * The source that provides this validity data.
+ */
+ private String validitySource;
+
+ /**
+ * The type of Validity, by default {@link ValidityType#EXISTENCE}.
+ */
+ private ValidityType validityType = ValidityType.EXISTENCE;
+
+ /**
+ * The target timezone id of this validity instance, allowing to restore the
+ * correct local date.
+ */
+ private String targetTimezoneId;
+
+ /**
+ * Constructor.
+ *
+ * @param validityType
+ * the validity type, not {@code null}.
+ * @param itemType
+ * the item type, not {@code null}.
+ * @param item
+ * the item constraint.
+ * @param validitySource
+ * the validity source id.
+ * @param from
+ * the starting UTC timestamp.
+ * @param to
+ * the ending UTC timestamp.
+ * @param targetTimezoneId
+ * the target timezone ID.
+ */
+ protected ValidityQuery(ValidityType validityType, Class<T> itemType,
+ T item, String validitySource, Long from, Long to,
+ String targetTimezoneId) {
+ if (itemType == null) {
+ throw new IllegalArgumentException("ItemClass required");
+ }
+ if (validityType == null) {
+ throw new IllegalArgumentException("ValidityType required.");
+ }
+ this.validityType = validityType;
+ this.itemType = itemType;
+ this.validitySource = validitySource;
+ this.from = from;
+ this.targetTimezoneId = targetTimezoneId;
+ this.item = item;
+ this.to = to;
+ }
+
+ /**
+ * Sets the {@link ValidityType} required, by default
+ * {@link ValidityType#EXISTENCE} is used.
+ *
+ * @return the validity type used, not {@code null}.
+ */
+ public ValidityType getValidityType() {
+ return this.validityType;
+ }
+
+ /**
+ * Access the item class for which the validities are queried. It is also
+ * possible query only for a related {@link Class} instance, which will
+ * select all validities of all items of that type.<br/>
+ * If {@link #item} was set, this method returns the class of {@link #item},
+ * so implementors of {@link ValidityProviderSpi} must additionally
+ * explicitly check, if {@link #getItem()} is returning any non {@code null}
+ * value.
+ *
+ * @see #getRelatedToInstance()
+ *
+ * @return the item The item for which the validity information is queried.
+ */
+ public final Class<T> getItemType() {
+ return itemType;
+ }
+
+ /**
+ * Access the item for which the validities are queried. It is also possible
+ * pass a {@link Class} instance here, which will select all validities of
+ * all items of that type.
+ *
+ * @return the item The item for which the validity information is queried.
+ */
+ public final T getItem() {
+ return item;
+ }
+
+ /**
+ * Get the starting range, for which validities are queried.0
+ *
+ * @return the from timestamp, or {@code null].
+ */
+ public final Long getFrom() {
+ return from;
+ }
+
+ /**
+ * Get the ending range, for which validities are queried.0
+ *
+ * @return the to timestamp, or {@code null].
+ */
+ public final Long getTo() {
+ return to;
+ }
+
+ /**
+ * Get the validity source, thus effectively asking for information provided
+ * by a specific source.
+ *
+ * @return the validitySource
+ */
+ public final String getValiditySource() {
+ return validitySource;
+ }
+
+ /**
+ * Get the target timezone Id, to be returned by the {@link Validities}
+ * singleton.
+ *
+ * @return the targetTimezoneId
+ */
+ public final String getTargetTimezoneId() {
+ return targetTimezoneId;
+ }
+
+ /**
+ * Checks if no explicit time range was defined for the query.
+ *
+ * @return true, if both {@link #from} and {@link #to} are {@code null}.
+ */
+ public boolean isTimeUnbounded() {
+ return from == null && to == null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ValidityQuery [itemType=" + itemType + ", item=" + item
+ + ", from=" + from + ", to=" + to
+ + ", targetTimezoneId=" + targetTimezoneId
+ + ", validitySource=" + validitySource + ", validityType="
+ + validityType + "]";
+ }
+
+ /**
+ * For accessing {@link ValidityInfo} instances from the {@link Validities}
+ * singleton, instances of this class must be created an configured.
+ * <p>
+ * This class is immutable, thread-safe and {@link Serializable}.
+ *
+ * @author Anatole Tresch
+ *
+ * @param <T>
+ * the item type, on which validities are defined.
+ */
+ public static class Builder<T> {
+ /** The base item. */
+ protected T item;
+ /** The base item. */
+ protected Class<T> itemType;
+ /**
+ * The starting UTC timestamp for the validity period, or null.
+ */
+ protected Long from;
+ /**
+ * The ending UTC timestamp for the validity period, or null.
+ */
+ protected Long to;
+ /**
+ * The source that provides this validity data.
+ */
+ protected String validitySource;
+
+ /**
+ * The type of Validity, by default {@link ValidityType#EXISTENCE}.
+ */
+ protected ValidityType validityType = ValidityType.EXISTENCE;
+
+ /**
+ * The target timezone id of this validity instance, allowing to restore
+ * the correct local date.
+ */
+ protected String targetTimezoneId;
+
+ /**
+ * Creates a new validity query.
+ *
+ * @param validityType
+ * The validity type.
+ * @param itemClass
+ * the type for which validities are queried.
+ */
+ public Builder(ValidityType validityType, Class<T> itemType) {
+ if (validityType == null) {
+ throw new IllegalArgumentException("validityType required");
+ }
+ this.validityType = validityType;
+ }
+
+ /**
+ * Creates a new validity query.
+ *
+ * @param itemClass
+ * the type for which validities are queried.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Builds a new {@link ValidityQuery}.
+ *
+ * @return the new query, never {@code null}.
+ * @throws IllegalArgumentException
+ * if the query could not be built.
+ */
+ public ValidityQuery<T> build() {
+ return new ValidityQuery<T>(validityType, itemType, item,
+ validitySource, from, to, targetTimezoneId);
+ }
+
+ /**
+ * Sets the target item.
+ *
+ * @param item
+ * the target item
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withItem(T item) {
+ this.item = item;
+ return this;
+ }
+
+ /**
+ * Sets the target item type.
+ *
+ * @param item
+ * the target item type, not {@code null}.
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withItemType(Class<T> itemType) {
+ if (itemType == null) {
+ throw new IllegalArgumentException("ItemClass required");
+ }
+ this.itemType = itemType;
+ return this;
+ }
+
+ /**
+ * Sets the target timezone ID.
+ *
+ * @param timezoneÎD
+ * the target timezone ID
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withTargetTimezoneID(String timezoneÎD) {
+ this.targetTimezoneId = timezoneÎD;
+ return this;
+ }
+
+ /**
+ * Sets the target timezone.
+ *
+ * @param timezone
+ * the target timezone
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withTargetTimezone(TimeZone timezone) {
+ this.targetTimezoneId = timezone.getID();
+ return this;
+ }
+
+ /**
+ * Sets the {@link #from} timestamp.
+ *
+ * @param timestamp
+ * The from timestamp.
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withFrom(long timestamp) {
+ this.from = timestamp;
+ return this;
+ }
+
+ /**
+ * Sets the {@link #to} timestamp.
+ *
+ * @param timestamp
+ * The to timestamp.
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withTo(long timestamp) {
+ this.to = timestamp;
+ return this;
+ }
+
+ /**
+ * Sets the validity provider to be queried. If not set all registered
+ * and matching providers may return a result. The first non null result
+ * is considered the final result in such a scenario.
+ *
+ * @param source
+ * the source identifier
+ * @return the instance, for chaining.
+ */
+ public Builder<T> withValiditySource(String source) {
+ this.validitySource = source;
+ return this;
+ }
+
+ /**
+ * Sets the {@link ValidityType} required. It is also possible to pass
+ * {@link ValidityType#ANY} to query all validities known for an item.
+ *
+ * @param validityType
+ * @return
+ */
+ public Builder<T> withValidityType(
+ ValidityType validityType) {
+ if (validityType == null) {
+ throw new IllegalArgumentException("ValidityType required.");
+ }
+ this.validityType = validityType;
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ValidityQuery.Builder [itemType=" + itemType + ", item="
+ + item
+ + ", from=" + from + ", to=" + to
+ + ", targetTimezoneId=" + targetTimezoneId
+ + ", validitySource=" + validitySource + ", validityType="
+ + validityType + "]";
+ }
+
+ }
+}
View
52 money-api/platform/.classpath
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
View
406 money-api/platform/src/main/java/javax/money/CurrencyNamespace.java
@@ -1,203 +1,203 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money;
-
-import java.io.Serializable;
-import java.util.Currency;
-import java.util.Map;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.money.spi.CurrencyNamespaceProviderSpi;
-
-/**
- * This class models the type of a {@link CurrencyUnit} namespace as immutable
- * value type. Basically the types possible are determined by the loaded
- * CurrencyNamespaceProviderSpi instances. Typical use cases is that exchange
- * rates for different credit card systems or debit/credit may differ. This
- * class allows to distinguish these rates and also provides access to the rate
- * types used.
- *
- * @author Anatole Tresch
- */
-public final class CurrencyNamespace implements Serializable,
- Comparable<CurrencyNamespace> {
-
- /**
- * The predefined name space for ISO 4217 currencies, similar to
- * {@link Currency}.
- */
- public static final String ISO_NAMESPACE_ID = "ISO-4217";
-
- /**
- * The default ISO namespace.
- */
- public static final CurrencyNamespace ISO_NAMESPACE = new CurrencyNamespace(
- ISO_NAMESPACE_ID);
- // TODO see https://en.wikipedia.org/wiki/ISO_4217#Without_currency_code
-
- /**
- * serialVersionUID.
- */
- private static final long serialVersionUID = -7505497771490888058L;
- /** The id of this type. */
- private final String id;
- /** The cache of types. */
- private static final Map<String, CurrencyNamespace> CONFIGURED_INSTANCES = new ConcurrentHashMap<String, CurrencyNamespace>();
-
- private static ServiceLoader<CurrencyNamespaceProviderSpi> namespaceProviders;
-
- /**
- * Loads the registered CurrencyNamespaceProviderSpi instances and
- * initializes the according namespaces.
- */
- static {
- try {
- CONFIGURED_INSTANCES.put(ISO_NAMESPACE.getId(), ISO_NAMESPACE);
- namespaceProviders = ServiceLoader
- .load(CurrencyNamespaceProviderSpi.class);
- for (CurrencyNamespaceProviderSpi prov : namespaceProviders) {
- for (String ns : prov.getNamespaces()) {
- CONFIGURED_INSTANCES.put(ns, new CurrencyNamespace(ns));
- }
- }
- Logger.getLogger(CurrencyNamespace.class.getName())
- .info("Defined Currency namespaces: "
- + CONFIGURED_INSTANCES.keySet());
- } catch (Exception e) {
- Logger.getLogger(CurrencyNamespace.class.getName())
- .log(Level.SEVERE,
- "Failed to initialize CurrencyNamespaceProviderSpis, possibly only ISO namespace will be available.",
- e);
- }
- }
-
- /**
- * Access a namespace by its name. A namespace must be defined by
- * registering a corresponding {@link CurrencyNamespaceProviderSpi} spi
- * using the JDK {@link ServiceLoader}.
- *
- * @see #getAvailableNamespaces()
- * @param id
- * The namespace identifier.
- * @return The namespace instance.
- * @throws IllegalArgumentException
- * If the required nymespace is not available.
- */
- public static CurrencyNamespace of(String id) {
- if (id == null) {
- throw new IllegalArgumentException("id required.");
- }
- CurrencyNamespace instance = CONFIGURED_INSTANCES.get(id);
- if (instance == null) {
- throw new IllegalArgumentException("Invalid currency namespace '"
- + id + "', supported namespaces are "
- + CONFIGURED_INSTANCES.keySet());
- }
- return instance;
- }
-
- /**
- * Access all currently available Currency namespaces.
- *
- * @return the available currency namespaces.
- */
- public static Set<String> getAvailableNamespaces() {
- return CONFIGURED_INSTANCES.keySet();
- }
-
- /**
- * Constructs a new instance of an ExchangeRateType..
- *
- * @param id
- * The id of this type instance, never null.
- */
- public CurrencyNamespace(String id) {
- if (id == null) {
- throw new IllegalArgumentException("Id must not be null.");
- }
- this.id = id;
- }
-
- /**
- * Get the identifier of this instance.
- *
- * @return The identifier, never null.
- */
- public String getId() {
- return this.id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- CurrencyNamespace other = (CurrencyNamespace) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "CurrencyNamespace [id=" + id + "]";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(CurrencyNamespace o) {
- if (o == null) {
- return -1;
- }
- int compare = id.compareTo(o.id);
- return compare;
- }
-
-}
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money;
+
+import java.io.Serializable;
+import java.util.Currency;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.money.spi.CurrencyNamespaceProviderSpi;
+
+/**
+ * This class models the type of a {@link CurrencyUnit} namespace as immutable
+ * value type. Basically the types possible are determined by the loaded
+ * CurrencyNamespaceProviderSpi instances. Typical use cases is that exchange
+ * rates for different credit card systems or debit/credit may differ. This
+ * class allows to distinguish these rates and also provides access to the rate
+ * types used.
+ *
+ * @author Anatole Tresch
+ */
+public final class CurrencyNamespace implements Serializable,
+ Comparable<CurrencyNamespace> {
+
+ /**
+ * The predefined name space for ISO 4217 currencies, similar to
+ * {@link Currency}.
+ */
+ public static final String ISO_NAMESPACE_ID = "ISO-4217";
+
+ /**
+ * The default ISO namespace.
+ */
+ public static final CurrencyNamespace ISO_NAMESPACE = new CurrencyNamespace(
+ ISO_NAMESPACE_ID);
+ // TODO see https://en.wikipedia.org/wiki/ISO_4217#Without_currency_code
+
+ /**
+ * serialVersionUID.
+ */
+ private static final long serialVersionUID = -7505497771490888058L;
+ /** The id of this type. */
+ private final String id;
+ /** The cache of types. */
+ private static final Map<String, CurrencyNamespace> CONFIGURED_INSTANCES = new ConcurrentHashMap<String, CurrencyNamespace>();
+
+ private static ServiceLoader<CurrencyNamespaceProviderSpi> namespaceProviders;
+
+ /**
+ * Loads the registered CurrencyNamespaceProviderSpi instances and
+ * initializes the according namespaces.
+ */
+ static {
+ try {
+ CONFIGURED_INSTANCES.put(ISO_NAMESPACE.getId(), ISO_NAMESPACE);
+ namespaceProviders = ServiceLoader
+ .load(CurrencyNamespaceProviderSpi.class);
+ for (CurrencyNamespaceProviderSpi prov : namespaceProviders) {
+ for (String ns : prov.getNamespaces()) {
+ CONFIGURED_INSTANCES.put(ns, new CurrencyNamespace(ns));
+ }
+ }
+ Logger.getLogger(CurrencyNamespace.class.getName())
+ .info("Defined Currency namespaces: "
+ + CONFIGURED_INSTANCES.keySet());
+ } catch (Exception e) {
+ Logger.getLogger(CurrencyNamespace.class.getName())
+ .log(Level.SEVERE,
+ "Failed to initialize CurrencyNamespaceProviderSpis, possibly only ISO namespace will be available.",
+ e);
+ }
+ }
+
+ /**
+ * Access a namespace by its name. A namespace must be defined by
+ * registering a corresponding {@link CurrencyNamespaceProviderSpi} spi
+ * using the JDK {@link ServiceLoader}.
+ *
+ * @see #getAvailableNamespaces()
+ * @param id
+ * The namespace identifier.
+ * @return The namespace instance.
+ * @throws IllegalArgumentException
+ * If the required nymespace is not available.
+ */
+ public static CurrencyNamespace of(String id) {
+ if (id == null) {
+ throw new IllegalArgumentException("id required.");
+ }
+ CurrencyNamespace instance = CONFIGURED_INSTANCES.get(id);
+ if (instance == null) {
+ throw new IllegalArgumentException("Invalid currency namespace '"
+ + id + "', supported namespaces are "
+ + CONFIGURED_INSTANCES.keySet());
+ }
+ return instance;
+ }
+
+ /**
+ * Access all currently available Currency namespaces.
+ *
+ * @return the available currency namespaces.
+ */
+ public static Set<String> getAvailableNamespaces() {
+ return CONFIGURED_INSTANCES.keySet();
+ }
+
+ /**
+ * Constructs a new instance of an ExchangeRateType..
+ *
+ * @param id
+ * The id of this type instance, never null.
+ */
+ public CurrencyNamespace(String id) {
+ if (id == null) {
+ throw new IllegalArgumentException("Id must not be null.");
+ }
+ this.id = id;
+ }
+
+ /**
+ * Get the identifier of this instance.
+ *
+ * @return The identifier, never null.
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CurrencyNamespace other = (CurrencyNamespace) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "CurrencyNamespace [id=" + id + "]";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(CurrencyNamespace o) {
+ if (o == null) {
+ return -1;
+ }
+ int compare = id.compareTo(o.id);
+ return compare;
+ }
+
+}
View
64 money-api/platform/src/main/java/javax/money/Predicate.java
@@ -1,32 +1,32 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money;
-
-import java.io.Serializable;
-
-/**
- * This interface models a predicate, which just evaluates to {@code true} or
- * {@code false}, for an arbitrary item. Predicates are used in different areas
- * on the API.
- * <p>
- * Instances of this interface are required to be immutable, thread-safe and
- * {@link Serializable}.
- *
- * @author Anatole Tresch
- *
- * @param <T>
- * The item type targeting
- */
-public interface Predicate<T> extends MonetaryFunction<T, Boolean> {
-
-}
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money;
+
+import java.io.Serializable;
+
+/**
+ * This interface models a predicate, which just evaluates to {@code true} or
+ * {@code false}, for an arbitrary item. Predicates are used in different areas
+ * on the API.
+ * <p>
+ * Instances of this interface are required to be immutable, thread-safe and
+ * {@link Serializable}.
+ *
+ * @author Anatole Tresch
+ *
+ * @param <T>
+ * The item type targeting
+ */
+public interface Predicate<T> extends MonetaryFunction<T, Boolean> {
+
+}
View
74 money-api/platform/src/main/java/javax/money/spi/CurrencyNamespaceProviderSpi.java
@@ -1,37 +1,37 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money.spi;
-
-import java.util.Collection;
-import java.util.ServiceLoader;
-
-/**
- * Instances of this interface can be registered using the {@link ServiceLoader}
- * . This will define and enable the according currency namespaces, as returned
- * by {@link #getNamespaces()}.
- * <p>
- * Only currency namespaces that are defined by such a provider are possible to
- * be used.
- *
- * @author Anatole Tresch
- */
-public interface CurrencyNamespaceProviderSpi {
-
- /**
- * Provides the ids of the currency namespaces that are available.
- *
- * @return ids of the currency namespaces.
- */
- public Collection<String> getNamespaces();
-
-}
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money.spi;
+
+import java.util.Collection;
+import java.util.ServiceLoader;
+
+/**
+ * Instances of this interface can be registered using the {@link ServiceLoader}
+ * . This will define and enable the according currency namespaces, as returned
+ * by {@link #getNamespaces()}.
+ * <p>
+ * Only currency namespaces that are defined by such a provider are possible to
+ * be used.
+ *
+ * @author Anatole Tresch
+ */
+public interface CurrencyNamespaceProviderSpi {
+
+ /**
+ * Provides the ids of the currency namespaces that are available.
+ *
+ * @return ids of the currency namespaces.
+ */
+ public Collection<String> getNamespaces();
+
+}
View
198 money-api/platform/src/main/java/javax/money/spi/RoundingProviderSpi.java
@@ -1,99 +1,99 @@
-/*
- * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
- * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
- * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
- * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
- * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
- * BUTTON AT THE BOTTOM OF THIS PAGE.
- *
- * Specification: JSR-354 Money and Currency API ("Specification")
- *
- * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
- */
-package javax.money.spi;
-
-import java.util.ServiceLoader;
-
-import javax.money.CurrencyUnit;
-import javax.money.MonetaryOperator;
-
-/**
- * This SPI allows to extends/override the roundings available for
- * {@link CurrencyUnit}. The JSRs implementation already provides default
- * roundings. By registering instances of this interface using the JDK
- * {@link ServiceLoader}, the default behaviour can be overridden and extended,
- * e.g. for supporting also special roundings.
- * <p>
- * Implementations of this interface must be
- * <ul>
- * <li>thread-safe
- * <li>not require loading of other resources.
- * </ul>
- * If required, it is possible to implement this interface in a contextual way,
- * e.g. providing different roundings depending on the current EE application
- * context. Though in most cases rounding should be a general concept that does
- * not require contextual handling.
- *
- * @author Anatole Tresch
- */
-public interface RoundingProviderSpi {
-
- /**
- * Access the current valid rounding for the given {@link CurrencyUnit}.
- * <p>
- * Instances of {@link MonetaryOperator} returned, must be thread safe and
- * immutable.
- *
- * @param currency
- * the currency for which a rounding operator should be obtained,
- * not {@code null}.
- * @return the corresponding rounding instance, or {@code null}.
- */
- MonetaryOperator getRounding(CurrencyUnit currency);
-
- /**
- * Access the rounding for the given {@link CurrencyUnit}, that was valid at
- * the given timestamp.
- * <p>
- * Instances of {@link MonetaryOperator} returned, must be thread safe and
- * immutable.
- *
- * @param currency
- * the currency for which a rounding operator should be obtained,
- * not {@code null}.
- * @param timestamp
- * the target UTC timestamp, when the rounding should be valid.
- * @return the corresponding rounding instance, or {@code null}.
- */
- MonetaryOperator getRounding(CurrencyUnit currency, long timestamp);
-
- /**
- * Access the current valid rounding for the given {@link CurrencyUnit}.
- * <p>
- * Instances of {@link MonetaryOperator} returned, must be thread safe and
- * immutable.
- *
- * @param currency
- * the currency for which a rounding operator should be obtained,
- * not {@code null}.
- * @return the corresponding rounding instance, or {@code null}.
- */
- MonetaryOperator getCashRounding(CurrencyUnit currency);
-
- /**
- * Access the cash rounding for the given {@link CurrencyUnit}, that was
- * valid at the given timestamp.
- * <p>
- * Instances of {@link MonetaryOperator} returned, must be thread safe and
- * immutable.
- *
- * @param currency
- * the currency for which a rounding operator should be obtained,
- * not {@code null}.
- * @param timestamp
- * the target UTC timestamp, when the rounding should be valid.
- * @return the corresponding rounding instance, or {@code null}.
- */
- MonetaryOperator getCashRounding(CurrencyUnit currency, long timestamp);
-
-}
+/*
+ * CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE
+ * CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT.
+ * PLEASE READ THE TERMS AND CONDITIONS OF THIS AGREEMENT CAREFULLY. BY
+ * DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF THE
+ * AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE"
+ * BUTTON AT THE BOTTOM OF THIS PAGE.
+ *
+ * Specification: JSR-354 Money and Currency API ("Specification")
+ *
+ * Copyright (c) 2012-2013, Credit Suisse All rights reserved.
+ */
+package javax.money.spi;
+
+import java.util.ServiceLoader;
+
+import javax.money.CurrencyUnit;
+import javax.money.MonetaryOperator;
+
+/**
+ * This SPI allows to extends/override the roundings available for
+ * {@link CurrencyUnit}. The JSRs implementation already provides default
+ * roundings. By registering instances of this interface using the JDK
+ * {@link ServiceLoader}, the default behaviour can be overridden and extended,
+ * e.g. for supporting also special roundings.
+ * <p>
+ * Implementations of this interface must be
+ * <ul>
+ * <li>thread-safe
+ * <li>not require loading of other resources.
+ * </ul>
+ * If required, it is possible to implement this interface in a contextual way,
+ * e.g. providing different roundings depending on the current EE application
+ * context. Though in most cases rounding should be a general concept that does
+ * not require contextual handling.
+ *
+ * @author Anatole Tresch
+ */
+public interface RoundingProviderSpi {
+
+ /**
+ * Access the current valid rounding for the given {@link CurrencyUnit}.
+ * <p>
+ * Instances of {@link MonetaryOperator} returned, must be thread safe and
+ * immutable.
+ *
+ * @param currency
+ * the currency for which a rounding operator should be obtained,
+ * not {@code null}.
+ * @return the corresponding rounding instance, or {@code null}.
+ */
+ MonetaryOperator getRounding(CurrencyUnit currency);
+
+ /**
+ * Access the rounding for the given {@link CurrencyUnit}, that was valid at
+ * the given timestamp.
+ * <p>
+ * Instances of {@link MonetaryOperator} returned, must be thread safe and
+ * immutable.
+ *
+ * @param currency
+ * the currency for which a rounding operator should be obtained,
+ * not {@code null}.
+ * @param timestamp
+ * the target UTC timestamp, when the rounding should be valid.
+ * @return the corresponding rounding instance, or {@code null}.
+ */
+ MonetaryOperator getRounding(CurrencyUnit currency, long timestamp);
+
+ /**
+ * Access the current valid rounding for the given {@link CurrencyUnit}.
+ * <p>
+ * Instances of {@link MonetaryOperator} returned, must be thread safe and
+ * immutable.
+ *
+ * @param currency
+ * the currency for which a rounding operator should be obtained,
+ * not {@code null}.
+ * @return the corresponding rounding instance, or {@code null}.
+ */
+ MonetaryOperator getCashRounding(CurrencyUnit currency);
+
+ /**
+ * Access the cash rounding for the given {@link CurrencyUnit}, that was
+ * valid at the given timestamp.
+ * <p>
+ * Instances of {@link MonetaryOperator} returned, must be thread safe and
+ * immutable.
+ *
+ * @param currency
+ * the currency for which a rounding operator should be obtained,
+ * not {@code null}.
+ * @param timestamp
+ * the target UTC timestamp, when the rounding should be valid.
+ * @return the corresponding rounding instance, or {@code null}.
+ */
+ MonetaryOperator getCashRounding(CurrencyUnit currency, long timestamp);
+
+}
View
62 money-impl/java-ee/.classpath
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
View
52 money-impl/platform/.classpath
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
View
114 money-impl/platform/src/main/java/javax/money/function/AndPredicate.java
@@ -1,58 +1,58 @@
-/*
- * Copyright (c) 2012, 2013, Credit Suisse (Anatole Tresch), Werner Keil.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package javax.money.function;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.money.Predicate;
-
-
-/**
- * This predicate implements the logic {@code and} operations, where
- * {@code AndPredicate(p1,p2) == p1 && p2}.
- *
- * @author Anatole Tresch
- */
-final class AndPredicate<T> implements Predicate<T> {
- /** The child predicates. */
- private List<Predicate<? super T>> predicates = new ArrayList<Predicate<? super T>>();
-
- @SafeVarargs
- AndPredicate(Iterable<? extends Predicate<? super T>>... predicates) {
- for (Iterable<? extends Predicate<? super T>> iterable : predicates) {
- for (Predicate<? super T> predicate : iterable) {
- this.predicates.add(predicate);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.MonetaryFunction#apply(java.lang.Object)
- */
- @Override
- public Boolean apply(T value) {
- for (Predicate<? super T> predicate : predicates) {
- if (!predicate.apply(value)) {
- return Boolean.FALSE;
- }
- }
- return Boolean.TRUE;
- }
-
+/*
+ * Copyright (c) 2012, 2013, Credit Suisse (Anatole Tresch), Werner Keil.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package javax.money.function;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.money.Predicate;
+
+
+/**
+ * This predicate implements the logic {@code and} operations, where
+ * {@code AndPredicate(p1,p2) == p1 && p2}.
+ *
+ * @author Anatole Tresch
+ */
+final class AndPredicate<T> implements Predicate<T> {
+ /** The child predicates. */
+ private List<Predicate<? super T>> predicates = new ArrayList<Predicate<? super T>>();
+
+ @SafeVarargs
+ AndPredicate(Iterable<? extends Predicate<? super T>>... predicates) {
+ for (Iterable<? extends Predicate<? super T>> iterable : predicates) {
+ for (Predicate<? super T> predicate : iterable) {
+ this.predicates.add(predicate);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.MonetaryFunction#apply(java.lang.Object)
+ */
+ @Override
+ public Boolean apply(T value) {
+ for (Predicate<? super T> predicate : predicates) {
+ if (!predicate.apply(value)) {
+ return Boolean.FALSE;
+ }
+ }
+ return Boolean.TRUE;
+ }
+
}
View
458 money-impl/platform/src/main/java/javax/money/function/MonetaryFunctions.java
@@ -1,229 +1,229 @@
-/*
- * Copyright (c) 2012, 2013, Credit Suisse (Anatole Tresch), Werner Keil.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package javax.money.function;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-
-import javax.money.MonetaryAmount;
-import javax.money.MonetaryFunction;
-import javax.money.MonetaryOperator;
-
-/**
- * This singleton class provides access to the predefined monetary functions.
- * <p>
- * The class is thread-safe, which is also true for all functions returned by
- * this class.
- *
- * @author Anatole Tresch
- */
-public final class MonetaryFunctions {
- /** defaulkt Math context used. */
- private static final MathContext DEFAULT_MATH_CONTEXT = initDefaultMathContext();
- /** Shared reciprocal instance. */
- private static final Reciprocal RECIPROCAL = new Reciprocal();
-
- /**
- * The shared instance of this class.
- */
- private static final MinorPart MINORPART = new MinorPart();
- /** SHared minor units class. */
- private static final MinorUnits MINORUNITS = new MinorUnits();
- /** Shared major part instance. */
- private static final MajorPart MAJORPART = new MajorPart();
- /** Shared major units instance. */
- private static final MajorUnits MAJORUNITS = new MajorUnits();
- /**
- * The shared instance of this class.
- */
- private static final Total TOTAL = new Total();
- /** Shared average instance. */
- private static final Average AVERAGE = new Average();
-
- /**
- * The shared instance of this class.
- */
- private static final Maximum MAXIMUM = new Maximum();
- /** Shared minimum instance. */
- private static final Minimum MINIMUM = new Minimum();
-
- /**
- * Private singleton constructor.
- */
- private MonetaryFunctions() {
- // Singleton constructor
- }
-
- /**
- * Get {@link MathContext} for {@link Permil} instances.
- *
- * @return the {@link MathContext} to be used, by default
- * {@link MathContext#DECIMAL64}.
- */
- private static MathContext initDefaultMathContext() {
- // TODO Initialize default, e.g. by system properties, or better:
- // classpath properties!
- return MathContext.DECIMAL64;
- }
-
- /**
- * Return a {@link MonetaryOperator} realizing the recorpocal value of
- * {@code f(R) = 1/R}.
- *
- * @return the reciprocal operator, never {@code null}
- */
- public static MonetaryOperator reciprocal() {
- return RECIPROCAL;
- }
-
- /**
- * Factory method creating a new instance with the given {@code BigDecimal) permil value;
- * @param decimal the decimal value of the permil operator being created.
- * @return a new {@code Permil} operator
- */
- public static MonetaryOperator permil(BigDecimal decimal) {
- return new Permil(decimal);
- }
-
- /**
- * Factory method creating a new instance with the given {@code Number) permil value;
- * @param decimal the decimal value of the permil operator being created.
- * @return a new {@code Permil} operator
- */
- public static MonetaryOperator permil(Number number) {
- return permil(number, DEFAULT_MATH_CONTEXT);
- }
-
- /**
- * Factory method creating a new instance with the given {@code Number) permil value;
- * @param decimal the decimal value of the permil operator being created.
- * @return a new {@code Permil} operator
- */
- public static MonetaryOperator permil(Number number, MathContext mathContext) {
- return new Permil(getBigDecimal(number, mathContext));
- }
-
- /**
- * Converts to {@link BigDecimal}, if necessary, or casts, if possible.
- *
- * @param number
- * The {@link Number}
- * @param mathContext
- * the {@link MathContext}
- * @return the {@code number} as {@link BigDecimal}
- */
- private static final BigDecimal getBigDecimal(Number number,
- MathContext mathContext) {
- if (number instanceof BigDecimal) {
- return (BigDecimal) number;
- } else {
- return new BigDecimal(number.doubleValue(), mathContext);
- }
- }
-
- /**
- * Factory method creating a new instance with the given {@code BigDecimal) percent value;
- * @param decimal the decimal value of the percent operator being created.
- * @return a new {@code Percent} operator
- */
- public static MonetaryOperator percent(BigDecimal decimal) {
- return new Percent(decimal); // TODO caching, e.g. array for 1-100 might
- // work.
- }
-
- /**
- * Factory method creating a new instance with the given {@code Number) percent value;
- * @param decimal the decimal value of the percent operator being created.
- *
- * @return a new {@code Percent} operator
- */
- public static MonetaryOperator percent(Number number) {
- return percent(getBigDecimal(number, DEFAULT_MATH_CONTEXT));
- }
-
- /**
- * Access the shared instance of {@link MinorPart} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryOperator minorPart() {
- return MINORPART;
- }
-
- /**
- * Access the shared instance of {@link MajorPart} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryOperator majorPart() {
- return MAJORPART;
- }
-
- /**
- * Access the shared instance of {@link MinorPart} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryFunction<MonetaryAmount, Long> minorUnits() {
- return MINORUNITS;
- }
-
- /**
- * Access the shared instance of {@link MinorPart} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryFunction<MonetaryAmount, Long> majorUnits() {
- return MAJORUNITS;
- }
-
- /**
- * Access the shared instance of {@link Total} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryFunction<Iterable<? extends MonetaryAmount>, MonetaryAmount> total() {
- return TOTAL;
- }
-
- /**
- * Access the shared instance of {@link Total} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryFunction<Iterable<? extends MonetaryAmount>, MonetaryAmount> average() {
- return AVERAGE;
- }
-
- /**
- * Access the shared instance of {@link Total} for use.
- *
- * @return the shared instance, never {@code null}.
- */
- public static MonetaryFunction<Iterable<? extends MonetaryAmount>, MonetaryAmount> minimum() {
- return MINIMUM;
- }
-
- /**
- * Access the shared instance of {@link Total} for use.
- *
- * @return the shared instance, never {@code null}.