All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.mateu.mdd.vaadin.components.views.DummyConverter Maven / Gradle / Ivy

There is a newer version: 1.1.60
Show newest version
package io.mateu.mdd.vaadin.components.views;

import com.vaadin.data.Converter;
import com.vaadin.data.Result;
import com.vaadin.data.ValueContext;

public class DummyConverter implements Converter {

    private final Object valueIfNull;

    public DummyConverter(Object valueIfNull) {
        this.valueIfNull = valueIfNull;
    }

    public DummyConverter() {
        this.valueIfNull = "";
    }

    @Override
    public Result convertToModel(Object o, ValueContext valueContext) {
        return Result.ok(o);
    }

    @Override
    public Object convertToPresentation(Object o, ValueContext valueContext) {
        return o != null?"" + o:valueIfNull;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy