Class MediaTypeEditor
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- org.jboss.resteasy.propertyeditor.mediatype.editor.MediaTypeEditor
-
- All Implemented Interfaces:
PropertyEditor
public class MediaTypeEditor extends PropertyEditorSupport
Spring uses property editors heavily for managing conversion between String values and custom Object types; this is based on Java Beans PropertyEditor. Standard JavaBeans infrastructure will automatically discover PropertyEditor classes if they are in the same package as the class they handle. Also, these need to have the same name as that class plus the Editor suffix This is a property editor for javax.ws.rs.core.MediaType. This editor does not reside in the same package as MediaType, so a custom binding between the required type and the property editor would need to be defined in order to Spring-framework to use it. The property editory would need to be registered in the Spring Controller using the method annotated with @InitBinder. example @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(MediaType.class, new MediaTypeEditor()); }- Version:
- $Revision$
- Author:
- Justin Edelson
-
-
Constructor Summary
Constructors Constructor Description MediaTypeEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsText()
void
setAsText(String text)
-
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
-
-
-
-
Method Detail
-
getAsText
public String getAsText()
- Specified by:
getAsText
in interfacePropertyEditor
- Overrides:
getAsText
in classPropertyEditorSupport
-
setAsText
public void setAsText(String text) throws IllegalArgumentException
- Specified by:
setAsText
in interfacePropertyEditor
- Overrides:
setAsText
in classPropertyEditorSupport
- Throws:
IllegalArgumentException
-
-