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

com.github.stefanbirkner.editors.EmptyStringToNullEditor Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.github.stefanbirkner.editors;

import java.beans.PropertyEditor;

import com.github.stefanbirkner.editors.mapper.EmptyStringToNullMapper;
import com.github.stefanbirkner.editors.mapper.Mapper;

/**
 * An {@code EmptyStringToNullEditor} is a wrapper for building
 * {@code PropertyEditor}s that handle {@code setAsText("")} like
 * {@code setAsText(null)}.
 * 

* Wrap the original editor with the {@code EmptyStringToNullEditor} * *

PropertyEditor wrappedEditor = new EmptyStringToNullEditor(originalEditor);
* * When somebody calls {@code setAsText("")} on the {@code wrappedEditor}, * then it calls {@code setAsText(null)} on the {@code originalEditor}. All * other values and all other methods are delegated to the {@code originalEditor}. * * @author Stefan Birkner * @since 1.0.0 */ public class EmptyStringToNullEditor extends PropertyEditorWithMapper { private static final Mapper MAPPER = new EmptyStringToNullMapper(); public EmptyStringToNullEditor(PropertyEditor propertyEditor) { super(propertyEditor, MAPPER); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy