blob: e24c56cc9e26a2b54867a348770d33fefe30b813 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*
*/
package org.eclipse.osbp.ecview.extension.presentation.vaadin.converter;
import java.util.Locale;
import com.vaadin.data.util.converter.Converter;
/**
* The Class ObjectToStringConverter.
*/
@SuppressWarnings("serial")
public class ObjectToStringConverter implements Converter<String, Object> {
/* (non-Javadoc)
* @see com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, java.lang.Class, java.util.Locale)
*/
@Override
public Object convertToModel(String value,
Class<? extends Object> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return value;
}
/* (non-Javadoc)
* @see com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang.Object, java.lang.Class, java.util.Locale)
*/
@Override
public String convertToPresentation(Object value,
Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return (value!=null)?value.toString():"";
}
/* (non-Javadoc)
* @see com.vaadin.data.util.converter.Converter#getModelType()
*/
@Override
public Class<Object> getModelType() {
return Object.class;
}
/* (non-Javadoc)
* @see com.vaadin.data.util.converter.Converter#getPresentationType()
*/
@Override
public Class<String> getPresentationType() {
return String.class;
}
}