com.jaspersoft.studio.editor.preview.input.array.number.BigDecimalElement.java Source code

Java tutorial

Introduction

Here is the source code for com.jaspersoft.studio.editor.preview.input.array.number.BigDecimalElement.java

Source

/*******************************************************************************
 * Copyright (C) 2005 - 2014 TIBCO Software Inc. All rights reserved.
 * http://www.jaspersoft.com.
 * 
 * Unless you have purchased  a commercial license agreement from Jaspersoft,
 * the following license terms  apply:
 * 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package com.jaspersoft.studio.editor.preview.input.array.number;

import java.math.BigDecimal;
import java.util.Locale;

import org.apache.commons.validator.routines.BigDecimalValidator;

public class BigDecimalElement extends ANumberElement {

    @Override
    public Class<?> getSupportedType() {
        return BigDecimal.class;
    }

    protected boolean isValid(String number) {
        return BigDecimalValidator.getInstance().isValid(number, Locale.US);
    }

    @Override
    protected Object convertString(String str) {
        return new BigDecimal(str);
    }
}