Search in sources :

Example 1 with XStreamLocalDateConverter

use of name.abuchen.portfolio.util.XStreamLocalDateConverter in project portfolio by buchen.

the class ECBExchangeRateProvider method xstream.

@SuppressWarnings("nls")
private XStream xstream() {
    if (xstream == null) {
        synchronized (this) {
            if (xstream == null) {
                xstream = new XStream();
                xstream.setClassLoader(ECBExchangeRateProvider.class.getClassLoader());
                xstream.registerConverter(new XStreamLocalDateConverter());
                xstream.alias("data", ECBData.class);
                xstream.alias("series", ExchangeRateTimeSeriesImpl.class);
                xstream.alias("rate", ExchangeRate.class);
                xstream.useAttributeFor(ExchangeRate.class, "time");
                xstream.aliasField("t", ExchangeRate.class, "time");
                xstream.useAttributeFor(ExchangeRate.class, "value");
                xstream.aliasField("v", ExchangeRate.class, "value");
            }
        }
    }
    return xstream;
}
Also used : XStreamLocalDateConverter(name.abuchen.portfolio.util.XStreamLocalDateConverter) XStream(com.thoughtworks.xstream.XStream)

Example 2 with XStreamLocalDateConverter

use of name.abuchen.portfolio.util.XStreamLocalDateConverter in project portfolio by buchen.

the class ClientFactory method xstream.

@SuppressWarnings("nls")
private static XStream xstream() {
    if (xstream == null) {
        synchronized (ClientFactory.class) {
            if (xstream == null) {
                xstream = new XStream();
                xstream.setClassLoader(ClientFactory.class.getClassLoader());
                xstream.registerConverter(new XStreamLocalDateConverter());
                xstream.registerConverter(new XStreamLocalDateTimeConverter());
                xstream.registerConverter(new PortfolioTransactionConverter(xstream.getMapper(), xstream.getReflectionProvider()));
                xstream.useAttributeFor(Money.class, "amount");
                xstream.useAttributeFor(Money.class, "currencyCode");
                xstream.aliasAttribute(Money.class, "currencyCode", "currency");
                xstream.alias("account", Account.class);
                xstream.alias("client", Client.class);
                xstream.alias("settings", ClientSettings.class);
                xstream.alias("bookmark", Bookmark.class);
                xstream.alias("portfolio", Portfolio.class);
                xstream.alias("unit", Transaction.Unit.class);
                xstream.useAttributeFor(Transaction.Unit.class, "type");
                xstream.alias("account-transaction", AccountTransaction.class);
                xstream.alias("portfolio-transaction", PortfolioTransaction.class);
                xstream.alias("security", Security.class);
                xstream.alias("latest", LatestSecurityPrice.class);
                xstream.alias("category", Category.class);
                xstream.alias("watchlist", Watchlist.class);
                xstream.alias("investment-plan", InvestmentPlan.class);
                xstream.alias("attribute-type", AttributeType.class);
                xstream.alias("price", SecurityPrice.class);
                xstream.useAttributeFor(SecurityPrice.class, "date");
                xstream.aliasField("t", SecurityPrice.class, "date");
                xstream.useAttributeFor(SecurityPrice.class, "value");
                xstream.aliasField("v", SecurityPrice.class, "value");
                xstream.alias("cpi", ConsumerPriceIndex.class);
                xstream.useAttributeFor(ConsumerPriceIndex.class, "year");
                xstream.aliasField("y", ConsumerPriceIndex.class, "year");
                xstream.useAttributeFor(ConsumerPriceIndex.class, "month");
                xstream.aliasField("m", ConsumerPriceIndex.class, "month");
                xstream.useAttributeFor(ConsumerPriceIndex.class, "index");
                xstream.aliasField("i", ConsumerPriceIndex.class, "index");
                xstream.alias("buysell", BuySellEntry.class);
                xstream.alias("account-transfer", AccountTransferEntry.class);
                xstream.alias("portfolio-transfer", PortfolioTransferEntry.class);
                xstream.alias("taxonomy", Taxonomy.class);
                xstream.alias("classification", Classification.class);
                xstream.alias("assignment", Assignment.class);
                xstream.alias("dashboard", Dashboard.class);
                xstream.useAttributeFor(Dashboard.class, "name");
                xstream.alias("column", Dashboard.Column.class);
                xstream.alias("widget", Dashboard.Widget.class);
                xstream.useAttributeFor(Dashboard.Widget.class, "type");
                xstream.alias("event", SecurityEvent.class);
                xstream.alias("config-set", ConfigurationSet.class);
                xstream.alias("config", ConfigurationSet.Configuration.class);
            }
        }
    }
    return xstream;
}
Also used : XStreamLocalDateConverter(name.abuchen.portfolio.util.XStreamLocalDateConverter) XStreamLocalDateTimeConverter(name.abuchen.portfolio.util.XStreamLocalDateTimeConverter) XStream(com.thoughtworks.xstream.XStream)

Aggregations

XStream (com.thoughtworks.xstream.XStream)2 XStreamLocalDateConverter (name.abuchen.portfolio.util.XStreamLocalDateConverter)2 XStreamLocalDateTimeConverter (name.abuchen.portfolio.util.XStreamLocalDateTimeConverter)1