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

Java tutorial

Introduction

Here is the source code for com.jaspersoft.studio.editor.preview.input.array.number.ShortElement.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.util.Locale;

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

public class ShortElement extends ANumberElement {

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

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

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