
infra.beans.PropertyEditorRegistrar Maven / Gradle / Ivy
/*
* Copyright 2017 - 2024 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see [https://www.gnu.org/licenses/]
*/
package infra.beans;
/**
* Interface for strategies that register custom
* {@link java.beans.PropertyEditor property editors} with a
* {@link PropertyEditorRegistry property editor registry}.
*
* This is particularly useful when you need to use the same set of
* property editors in several different situations: write a corresponding
* registrar and reuse that in each case.
*
* @author Juergen Hoeller
* @author Harry Yang
* @see PropertyEditorRegistry
* @see java.beans.PropertyEditor
* @since 4.0 2022/2/17 17:41
*/
public interface PropertyEditorRegistrar {
/**
* Register custom {@link java.beans.PropertyEditor PropertyEditors} with
* the given {@code PropertyEditorRegistry}.
*
The passed-in registry will usually be a {@link BeanWrapper} or a
* {@link infra.validation.DataBinder DataBinder}.
*
It is expected that implementations will create brand new
* {@code PropertyEditors} instances for each invocation of this
* method (since {@code PropertyEditors} are not threadsafe).
*
* @param registry the {@code PropertyEditorRegistry} to register the
* custom {@code PropertyEditors} with
*/
void registerCustomEditors(PropertyEditorRegistry registry);
}