aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java
blob: 38859497fc622820408927c0e73d1f23af971814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.vaadin.tests.components.abstractfield;

import java.util.Locale;

import com.vaadin.v7.data.util.converter.Converter;

public class Vaadin6ImplicitDoubleConverter
        implements Converter<String, Double> {

    @Override
    public Double convertToModel(String value,
            Class<? extends Double> targetType, Locale locale)
            throws com.vaadin.v7.data.util.converter.Converter.ConversionException {
        if (null == value) {
            return null;
        }
        return new Double(value);
    }

    @Override
    public String convertToPresentation(Double value,
            Class<? extends String> targetType, Locale locale)
            throws com.vaadin.v7.data.util.converter.Converter.ConversionException {
        if (value == null) {
            return null;
        }
        return value.toString();

    }

    @Override
    public Class<Double> getModelType() {
        return Double.class;
    }

    @Override
    public Class<String> getPresentationType() {
        return String.class;
    }

}