Java 8 Currency - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Currency class.

This code example shows how to use the following methods:getCurrencyCode
     * @param currency 
     * @return 
     * @see org.jboss.resteasy.spi.StringConverter#toString(java.lang.Object) 
     */ 
    public String toString(Currency currency) {
        return currency.getCurrencyCode();
    } 
 
    /** 
     * Test method for currency converter. 
     *  
     * @param currency 
     * @return 
     */ 
    @GET 
    @Path(PATH_CONVERTER) 
    public String testCurrencyConverter(@PathParam(PARAM_CURRENCY) Currency currency) {
        LOGGER.info("Returning currency symbol"); 
        return currency.getSymbol();
    } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDefaultFractionDigits, getSymbol
     * @param c 
     */ 
    private void printCurrency(Currency c) {
        System.out.println();
        System.out.println(c.getCurrencyCode());
        System.out.println(c.getSymbol());
        System.out.println(c.getDefaultFractionDigits());
    } 
 
    /** 
     * helper method to display Locale info 
     */ 
    private static void printLocale(Locale loc) {
        System.out.println();
        System.out.println(loc.getDisplayName());
        System.out.println(loc.getCountry());
        System.out.println(loc.getLanguage());
        System.out.println(loc.getDisplayCountry());
        System.out.println(loc.getDisplayLanguage());
        System.out.println(loc.getDisplayName());
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
	} 
 
	@Override 
	public String getAsText() {
		Currency value = (Currency) getValue();
		return (value != null ? value.getCurrencyCode() : "");
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode, getDefaultFractionDigits, getSymbol
     *  
     * @param c 
     */ 
    private void printCurrency(Currency c) {
        System.out.println();
        System.out.println(c.getCurrencyCode());
        System.out.println(c.getSymbol());
        System.out.println(c.getDefaultFractionDigits());
    } 
 
    /** 
     * helper method to display Locale info 
     */ 
    private static void printLocale(Locale loc) {
        System.out.println();
        System.out.println(loc.getDisplayName());
        System.out.println(loc.getCountry());
        System.out.println(loc.getLanguage());
        System.out.println(loc.getDisplayCountry());
        System.out.println(loc.getDisplayLanguage());
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
 
    protected Money() { 
    } 
 
    public Money(BigDecimal value, Currency currency) {
        this(value, currency.getCurrencyCode());
    } 
 
    private Money(BigDecimal value, String currencyCode) {
        this.value = value.setScale(2, RoundingMode.HALF_EVEN);
        this.currencyCode = currencyCode;
    } 
 
    public Money(BigDecimal value) {
        this(value, DEFAULT_CURRENCY);
    } 
 
    public Money(double value, Currency currency) {
        this(new BigDecimal(value), currency.getCurrencyCode());
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
    } 
 
    @Test 
    public void shouldBeDraftWhenCreated() throws Exception { 
        assertEquals(OrderStatus.DRAFT, order.getStatus());
    } 
 
    @Test 
    public void shouldSubmitOrderWithProduct() throws Exception { 
        // when 
        order.addProduct(anyProduct(), 1);
        order.submit();
        // then 
        expectEvent(OrderSubmittedEvent.class); 
    } 
 
    @Test 
    public void shouldCountProductsNumberCorrectly() throws Exception { 
        // given 
        Product product = anyProduct();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode
 */ 
@Finder 
public class SqlProductFinder implements ProductFinder { 
 
    private static final int MAX_ITEMS_PER_PAGE = 50;
 
    @Inject 
    private NamedParameterJdbcOperations jdbcTemplate;
 
    @Override 
    public PaginatedResult<ProductListItemDto> findProducts(ProductSearchCriteria criteria) {
        int productsCount = countProducts(criteria);
        if (productsCount <= 0) {
            return new PaginatedResult<ProductListItemDto>(criteria.getPageNumber(), criteria.getItemsPerPage());
        } 
        Map<String, Object> parameters = new HashMap<String, Object>();
        String sqlQuery = createSqlSelectQuery(criteria, parameters);
        List<ProductListItemDto> products = jdbcTemplate.query(sqlQuery, parameters, new ProductListItemRowMapper());
        return new PaginatedResult<ProductListItemDto>(products, criteria.getPageNumber(), criteria.getItemsPerPage(),
                productsCount);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCurrencyCode, getSymbol
        int i = value ? -1 : 0;
        setAttribute(this.addr, UNUM_DECIMAL_ALWAYS_SHOWN, i);
    } 
 
    public void setCurrency(Currency currency) {
        setSymbol(this.addr, UNUM_CURRENCY_SYMBOL, currency.getSymbol());
        setSymbol(this.addr, UNUM_INTL_CURRENCY_SYMBOL, currency.getCurrencyCode());
    } 
 
    public void setGroupingSize(int value) {
        setAttribute(this.addr, UNUM_GROUPING_SIZE, value);
    } 
 
    public void setGroupingUsed(boolean value) {
        int i = value ? -1 : 0;
        setAttribute(this.addr, UNUM_GROUPING_USED, i);
    } 
 
    public void setMaximumFractionDigits(int value) {
        setAttribute(this.addr, UNUM_MAX_FRACTION_DIGITS, value);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Java 8 Currency Questions & Answers:

See Code Examples for Java 8 Currency Methods: