com.vaadin.data.converter.ConverterFactory Maven / Gradle / Ivy
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* license.
*/
package com.vaadin.data.converter;
import java.io.Serializable;
import java.util.Optional;
import com.vaadin.data.Converter;
/**
* Creates {@link Converter} instances capable to handle conversion between a
* model and a presentation type.
*
* @author Vaadin Ltd
* @since 8.16
*/
public interface ConverterFactory extends Serializable {
/**
* Attempts to create a {@link Converter} instance, capable to handle
* conversion between the given presentation and model types.
*
* An empty {@link Optional} is returned if a conversion cannot be
* performed.
*
* @param presentationType
* presentation type, not {@literal null}.
* @param modelType
* model type, not {@literal null}.
* @param
* The presentation type.
* @param
* The model type.
* @return a {@link Converter} instance wrapped into an {@link Optional}, or
* an empty {@link Optional} if no suitable converter is available.
*/
Optional> newInstance(Class presentationType,
Class modelType);
}