org.springframework.core.io.ResourceEditor Java Examples

The following examples show how to use org.springframework.core.io.ResourceEditor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpServletBean.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Map config parameters onto bean properties of this servlet, and
 * invoke subclass initialization.
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 */
@Override
public final void init() throws ServletException {

	// Set bean properties from init parameters.
	PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
	if (!pvs.isEmpty()) {
		try {
			BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
			ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
			bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, getEnvironment()));
			initBeanWrapper(bw);
			bw.setPropertyValues(pvs, true);
		}
		catch (BeansException ex) {
			if (logger.isErrorEnabled()) {
				logger.error("Failed to set bean properties on servlet '" + getServletName() + "'", ex);
			}
			throw ex;
		}
	}

	// Let subclasses do whatever initialization they like.
	initServletBean();
}
 
Example #2
Source File: ResourceEditorRegistrar.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Populate the given {@code registry} with the following resource editors:
 * ResourceEditor, InputStreamEditor, InputSourceEditor, FileEditor, URLEditor,
 * URIEditor, ClassEditor, ClassArrayEditor.
 * <p>If this registrar has been configured with a {@link ResourcePatternResolver},
 * a ResourceArrayPropertyEditor will be registered as well.
 * @see org.springframework.core.io.ResourceEditor
 * @see org.springframework.beans.propertyeditors.InputStreamEditor
 * @see org.springframework.beans.propertyeditors.InputSourceEditor
 * @see org.springframework.beans.propertyeditors.FileEditor
 * @see org.springframework.beans.propertyeditors.URLEditor
 * @see org.springframework.beans.propertyeditors.URIEditor
 * @see org.springframework.beans.propertyeditors.ClassEditor
 * @see org.springframework.beans.propertyeditors.ClassArrayEditor
 * @see org.springframework.core.io.support.ResourceArrayPropertyEditor
 */
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
	ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
	doRegisterEditor(registry, Resource.class, baseEditor);
	doRegisterEditor(registry, ContextResource.class, baseEditor);
	doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
	doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
	doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
	doRegisterEditor(registry, Reader.class, new ReaderEditor(baseEditor));
	doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));

	ClassLoader classLoader = this.resourceLoader.getClassLoader();
	doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
	doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
	doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));

	if (this.resourceLoader instanceof ResourcePatternResolver) {
		doRegisterEditor(registry, Resource[].class,
				new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	}
}
 
Example #3
Source File: ResourceEditorRegistrar.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Populate the given {@code registry} with the following resource editors:
 * ResourceEditor, InputStreamEditor, InputSourceEditor, FileEditor, URLEditor,
 * URIEditor, ClassEditor, ClassArrayEditor.
 * <p>If this registrar has been configured with a {@link ResourcePatternResolver},
 * a ResourceArrayPropertyEditor will be registered as well.
 * @see org.springframework.core.io.ResourceEditor
 * @see org.springframework.beans.propertyeditors.InputStreamEditor
 * @see org.springframework.beans.propertyeditors.InputSourceEditor
 * @see org.springframework.beans.propertyeditors.FileEditor
 * @see org.springframework.beans.propertyeditors.URLEditor
 * @see org.springframework.beans.propertyeditors.URIEditor
 * @see org.springframework.beans.propertyeditors.ClassEditor
 * @see org.springframework.beans.propertyeditors.ClassArrayEditor
 * @see org.springframework.core.io.support.ResourceArrayPropertyEditor
 */
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
	ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
	doRegisterEditor(registry, Resource.class, baseEditor);
	doRegisterEditor(registry, ContextResource.class, baseEditor);
	doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
	doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
	doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
	doRegisterEditor(registry, Path.class, new PathEditor(baseEditor));
	doRegisterEditor(registry, Reader.class, new ReaderEditor(baseEditor));
	doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));

	ClassLoader classLoader = this.resourceLoader.getClassLoader();
	doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
	doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
	doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));

	if (this.resourceLoader instanceof ResourcePatternResolver) {
		doRegisterEditor(registry, Resource[].class,
				new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	}
}
 
Example #4
Source File: ResourceEditorRegistrar.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Populate the given {@code registry} with the following resource editors:
 * ResourceEditor, InputStreamEditor, InputSourceEditor, FileEditor, URLEditor,
 * URIEditor, ClassEditor, ClassArrayEditor.
 * <p>If this registrar has been configured with a {@link ResourcePatternResolver},
 * a ResourceArrayPropertyEditor will be registered as well.
 * @see org.springframework.core.io.ResourceEditor
 * @see org.springframework.beans.propertyeditors.InputStreamEditor
 * @see org.springframework.beans.propertyeditors.InputSourceEditor
 * @see org.springframework.beans.propertyeditors.FileEditor
 * @see org.springframework.beans.propertyeditors.URLEditor
 * @see org.springframework.beans.propertyeditors.URIEditor
 * @see org.springframework.beans.propertyeditors.ClassEditor
 * @see org.springframework.beans.propertyeditors.ClassArrayEditor
 * @see org.springframework.core.io.support.ResourceArrayPropertyEditor
 */
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
	ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
	doRegisterEditor(registry, Resource.class, baseEditor);
	doRegisterEditor(registry, ContextResource.class, baseEditor);
	doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
	doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
	doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
	if (pathClass != null) {
		doRegisterEditor(registry, pathClass, new PathEditor(baseEditor));
	}
	doRegisterEditor(registry, Reader.class, new ReaderEditor(baseEditor));
	doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));

	ClassLoader classLoader = this.resourceLoader.getClassLoader();
	doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
	doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
	doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));

	if (this.resourceLoader instanceof ResourcePatternResolver) {
		doRegisterEditor(registry, Resource[].class,
				new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	}
}
 
Example #5
Source File: ResourceEditorRegistrar.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Populate the given {@code registry} with the following resource editors:
 * ResourceEditor, InputStreamEditor, InputSourceEditor, FileEditor, URLEditor,
 * URIEditor, ClassEditor, ClassArrayEditor.
 * <p>If this registrar has been configured with a {@link ResourcePatternResolver},
 * a ResourceArrayPropertyEditor will be registered as well.
 * @see org.springframework.core.io.ResourceEditor
 * @see org.springframework.beans.propertyeditors.InputStreamEditor
 * @see org.springframework.beans.propertyeditors.InputSourceEditor
 * @see org.springframework.beans.propertyeditors.FileEditor
 * @see org.springframework.beans.propertyeditors.URLEditor
 * @see org.springframework.beans.propertyeditors.URIEditor
 * @see org.springframework.beans.propertyeditors.ClassEditor
 * @see org.springframework.beans.propertyeditors.ClassArrayEditor
 * @see org.springframework.core.io.support.ResourceArrayPropertyEditor
 */
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
	ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
	doRegisterEditor(registry, Resource.class, baseEditor);
	doRegisterEditor(registry, ContextResource.class, baseEditor);
	doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
	doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
	doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
	doRegisterEditor(registry, Path.class, new PathEditor(baseEditor));
	doRegisterEditor(registry, Reader.class, new ReaderEditor(baseEditor));
	doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));

	ClassLoader classLoader = this.resourceLoader.getClassLoader();
	doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
	doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
	doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));

	if (this.resourceLoader instanceof ResourcePatternResolver) {
		doRegisterEditor(registry, Resource[].class,
				new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	}
}
 
Example #6
Source File: ResourceEditorRegistrar.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
/**
 * Populate the given {@code registry} with the following resource editors:
 * ResourceEditor, InputStreamEditor, InputSourceEditor, FileEditor, URLEditor,
 * URIEditor, ClassEditor, ClassArrayEditor.
 * <p>If this registrar has been configured with a {@link ResourcePatternResolver},
 * a ResourceArrayPropertyEditor will be registered as well.
 * @see ResourceEditor
 * @see org.springframework.beans.propertyeditors.InputStreamEditor
 * @see org.springframework.beans.propertyeditors.InputSourceEditor
 * @see org.springframework.beans.propertyeditors.FileEditor
 * @see org.springframework.beans.propertyeditors.URLEditor
 * @see org.springframework.beans.propertyeditors.URIEditor
 * @see org.springframework.beans.propertyeditors.ClassEditor
 * @see org.springframework.beans.propertyeditors.ClassArrayEditor
 * @see ResourceArrayPropertyEditor
 */
@Override
public void registerCustomEditors(PropertyEditorRegistry registry) {
	ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
	doRegisterEditor(registry, Resource.class, baseEditor);
	doRegisterEditor(registry, ContextResource.class, baseEditor);
	doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
	doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
	doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
	doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));

	ClassLoader classLoader = this.resourceLoader.getClassLoader();
	doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
	doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
	doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));

	if (this.resourceLoader instanceof ResourcePatternResolver) {
		doRegisterEditor(registry, Resource[].class,
				new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	}
}
 
Example #7
Source File: HttpServletBean.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Map config parameters onto bean properties of this servlet, and
 * invoke subclass initialization.
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 */
@Override
public final void init() throws ServletException {

	// Set bean properties from init parameters.
	// 解析 init-param 并封装到 pvs 变量中
	PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
	if (!pvs.isEmpty()) {
		try {
			// 将当前的这个 Servlet 类转换为一个 BeanWrapper,从而能够以 Spring 的方式对 init—param 的值注入
			BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
			ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
			// 注册自定义属性编辑器,一旦遇到 Resource 类型的属性将会使用 ResourceEditor 进行解析
			bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, getEnvironment()));
			// 空实现,留给子类覆盖
			initBeanWrapper(bw);
			bw.setPropertyValues(pvs, true);
		}
		catch (BeansException ex) {
			if (logger.isErrorEnabled()) {
				logger.error("Failed to set bean properties on servlet '" + getServletName() + "'", ex);
			}
			throw ex;
		}
	}

	// Let subclasses do whatever initialization they like.
	// 初始化 servletBean (让子类实现,这里它的实现子类是 FrameworkServlet)
	initServletBean();
}
 
Example #8
Source File: HttpServletBean.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Map config parameters onto bean properties of this servlet, and
 * invoke subclass initialization.
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 */
@Override
public final void init() throws ServletException {
	if (logger.isDebugEnabled()) {
		logger.debug("Initializing servlet '" + getServletName() + "'");
	}

	// Set bean properties from init parameters.
	PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
	if (!pvs.isEmpty()) {
		try {
			BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
			ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
			bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, getEnvironment()));
			initBeanWrapper(bw);
			bw.setPropertyValues(pvs, true);
		}
		catch (BeansException ex) {
			if (logger.isErrorEnabled()) {
				logger.error("Failed to set bean properties on servlet '" + getServletName() + "'", ex);
			}
			throw ex;
		}
	}

	// Let subclasses do whatever initialization they like.
	initServletBean();

	if (logger.isDebugEnabled()) {
		logger.debug("Servlet '" + getServletName() + "' configured successfully");
	}
}
 
Example #9
Source File: GenericPortletBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Map config parameters onto bean properties of this portlet, and
 * invoke subclass initialization.
 * @throws PortletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 */
@Override
public final void init() throws PortletException {
	if (logger.isInfoEnabled()) {
		logger.info("Initializing portlet '" + getPortletName() + "'");
	}

	// Set bean properties from init parameters.
	try {
		PropertyValues pvs = new PortletConfigPropertyValues(getPortletConfig(), this.requiredProperties);
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		ResourceLoader resourceLoader = new PortletContextResourceLoader(getPortletContext());
		bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, getEnvironment()));
		initBeanWrapper(bw);
		bw.setPropertyValues(pvs, true);
	}
	catch (BeansException ex) {
		logger.error("Failed to set bean properties on portlet '" + getPortletName() + "'", ex);
		throw ex;
	}

	// let subclasses do whatever initialization they like
	initPortletBean();

	if (logger.isInfoEnabled()) {
		logger.info("Portlet '" + getPortletName() + "' configured successfully");
	}
}
 
Example #10
Source File: HttpServletBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Map config parameters onto bean properties of this servlet, and
 * invoke subclass initialization.
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 */
@Override
public final void init() throws ServletException {
	if (logger.isDebugEnabled()) {
		logger.debug("Initializing servlet '" + getServletName() + "'");
	}

	// Set bean properties from init parameters.
	try {
		PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
		bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, getEnvironment()));
		initBeanWrapper(bw);
		bw.setPropertyValues(pvs, true);
	}
	catch (BeansException ex) {
		logger.error("Failed to set bean properties on servlet '" + getServletName() + "'", ex);
		throw ex;
	}

	// Let subclasses do whatever initialization they like.
	initServletBean();

	if (logger.isDebugEnabled()) {
		logger.debug("Servlet '" + getServletName() + "' configured successfully");
	}
}
 
Example #11
Source File: GenericFilterBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Standard way of initializing this filter.
 * Map config parameters onto bean properties of this filter, and
 * invoke subclass initialization.
 * @param filterConfig the configuration for this filter
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 * @see #initFilterBean
 */
@Override
public final void init(FilterConfig filterConfig) throws ServletException {
	Assert.notNull(filterConfig, "FilterConfig must not be null");
	if (logger.isDebugEnabled()) {
		logger.debug("Initializing filter '" + filterConfig.getFilterName() + "'");
	}

	this.filterConfig = filterConfig;

	// Set bean properties from init parameters.
	try {
		PropertyValues pvs = new FilterConfigPropertyValues(filterConfig, this.requiredProperties);
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		ResourceLoader resourceLoader = new ServletContextResourceLoader(filterConfig.getServletContext());
		bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, this.environment));
		initBeanWrapper(bw);
		bw.setPropertyValues(pvs, true);
	}
	catch (BeansException ex) {
		String msg = "Failed to set bean properties on filter '" +
			filterConfig.getFilterName() + "': " + ex.getMessage();
		logger.error(msg, ex);
		throw new NestedServletException(msg, ex);
	}

	// Let subclasses do whatever initialization they like.
	initFilterBean();

	if (logger.isDebugEnabled()) {
		logger.debug("Filter '" + filterConfig.getFilterName() + "' configured successfully");
	}
}
 
Example #12
Source File: BeanUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void testFindEditorByConvention() {
	assertEquals(ResourceEditor.class, BeanUtils.findEditorByConvention(Resource.class).getClass());
}
 
Example #13
Source File: ReaderEditor.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a new ReaderEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public ReaderEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #14
Source File: URLEditor.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a new URLEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public URLEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #15
Source File: PathEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new PathEditor, using the default ResourceEditor underneath.
 */
public PathEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #16
Source File: FileEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new FileEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public FileEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #17
Source File: PathEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new PathEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public PathEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #18
Source File: FileEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new FileEditor, using a default ResourceEditor underneath.
 */
public FileEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #19
Source File: ReaderEditor.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a new ReaderEditor, using the default ResourceEditor underneath.
 */
public ReaderEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #20
Source File: URLEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using a default ResourceEditor underneath.
 */
public URLEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #21
Source File: URLEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public URLEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #22
Source File: ReaderEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new ReaderEditor, using the default ResourceEditor underneath.
 */
public ReaderEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #23
Source File: ReaderEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new ReaderEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public ReaderEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #24
Source File: InputStreamEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new InputStreamEditor, using the default ResourceEditor underneath.
 */
public InputStreamEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #25
Source File: InputStreamEditor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new InputStreamEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public InputStreamEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #26
Source File: URLEditor.java    From blog_demos with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using the default ResourceEditor underneath.
 */
public URLEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #27
Source File: URLEditor.java    From blog_demos with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public URLEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #28
Source File: URLEditor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using the default ResourceEditor underneath.
 */
public URLEditor() {
	this.resourceEditor = new ResourceEditor();
}
 
Example #29
Source File: URLEditor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new URLEditor, using the given ResourceEditor underneath.
 * @param resourceEditor the ResourceEditor to use
 */
public URLEditor(ResourceEditor resourceEditor) {
	Assert.notNull(resourceEditor, "ResourceEditor must not be null");
	this.resourceEditor = resourceEditor;
}
 
Example #30
Source File: BeanUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testFindEditorByConvention() {
	assertEquals(ResourceEditor.class, BeanUtils.findEditorByConvention(Resource.class).getClass());
}