Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smoketurner/dropwizard-money
Dropwizard Money Bundle
https://github.com/smoketurner/dropwizard-money
dropwizard dropwizard-money java money
Last synced: 3 months ago
JSON representation
Dropwizard Money Bundle
- Host: GitHub
- URL: https://github.com/smoketurner/dropwizard-money
- Owner: smoketurner
- License: apache-2.0
- Archived: true
- Created: 2017-04-06T16:27:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-29T12:21:15.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T18:09:18.342Z (5 months ago)
- Topics: dropwizard, dropwizard-money, java, money
- Language: Java
- Homepage:
- Size: 539 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-dropwizard - dropwizard-money - A Money bundle for Dropwizard (Open Source / Eclipse)
README
Dropwizard Money
================
[![Build Status](https://travis-ci.org/smoketurner/dropwizard-money.svg?branch=master)](https://travis-ci.org/smoketurner/dropwizard-money)
[![Coverage Status](https://coveralls.io/repos/smoketurner/dropwizard-money/badge.svg?branch=master)](https://coveralls.io/r/smoketurner/dropwizard-money?branch=master)
[![Maven Central](https://img.shields.io/maven-central/v/com.smoketurner.dropwizard/dropwizard-money.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.smoketurner.dropwizard/dropwizard-money/)
[![GitHub license](https://img.shields.io/github/license/smoketurner/dropwizard-money.svg?style=flat-square)](https://github.com/smoketurner/dropwizard-money/tree/master)
[![Become a Patron](https://img.shields.io/badge/Patron-Patreon-red.svg)](https://www.patreon.com/bePatron?u=9567343)A bundle for using [Money](http://javamoney.github.io) objects in Dropwizard applications. This bundle provides:
* Jackson module for serializing/deserializing `Money`/`FastMoney` objects
* JDBI argument mappers for persisting `Money` objects as a BigDecimal SQL type
* JDBI argument mappers for persisting `FastMoney` objects as a Numeric SQL type
* Jersey `MoneyParam` for serializing/deserialzing `Money` objects
* Jersey `FastMoneyParam` for serializing/deserialzing `FastMoney` objects
* Jersey `MonetaryExceptionMapper` for handling `MonetaryException`Usage
-----Within your `Configuration` class, add the following:
```java
@Valid
@NotNull
private final MoneyFactory money = new MoneyFactory();@JsonProperty
public MoneyFactory getMoneyFactory() {
return money;
}
```Then within your `Application` class:
```java
@Override
public void initialize(Bootstrap bootstrap) {
bootstrap.addBundle(new MoneyBundle() {
@Override
public MoneyFactory getMoneyFactory(MyConfiguration configuration) {
return configuration.getMoneyFactory();
}
});
}@Override
public void run(MyConfiguration config, Environment environment) throws Exception {
final String defaultCurrency = config.getMoneyFactory().getDefaultCurrencyCode();final DBIFactory factory = new DBIFactory();
final DBI jdbi = factory.build(environment, config.getDataSourceFactory(), "postgresql");
jdbi.registerArgumentFactory(new MoneyArgumentFactory());
jdbi.registerColumnMapper(new MoneyMapper(defaultCurrency));
}
```Maven Artifacts
---------------This project is available on Maven Central. To add it to your project simply add the following dependencies to your `pom.xml`:
```xml
com.smoketurner.dropwizard
dropwizard-money
1.2.0-1```
Support
-------Please file bug reports and feature requests in [GitHub issues](https://github.com/smoketurner/dropwizard-money/issues).
License
-------Copyright (c) 2018 Smoke Turner, LLC
This library is licensed under the Apache License, Version 2.0.
See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.