nl.gx.webmanager.springmvc.editor
Class WmIdPropertyEditor
java.lang.Object
java.beans.PropertyEditorSupport
nl.gx.webmanager.springmvc.editor.WmIdPropertyEditor
- All Implemented Interfaces:
- java.beans.PropertyEditor
public class WmIdPropertyEditor
- extends java.beans.PropertyEditorSupport
This class represents a generic property editor for WmIds. It provides an
editor for all classes that implement the WmId interface. The property editor
invokes the EntityManager in order to transform a String to a WmId. Therefore
the EntityManager is input parameter of the constructor of this property
editor.Add this property editor in your initBinder method. For example to
define a property editor for the language:
public void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
super.initBinder(request, binder);
// Register basic property editors
binder.registerCustomEditor(Language.class, new WmIdPropertyEditor(myEntityManager));
}
- Author:
- bartk
|
Method Summary |
java.lang.String |
getAsText()
Format the WmId as String, using the .toString() method of the WmId
implementations. |
void |
setAsText(java.lang.String text)
Parse the WmId from the given text |
| Methods inherited from class java.beans.PropertyEditorSupport |
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WmIdPropertyEditor
public WmIdPropertyEditor(EntityManager entityManager)
- Constructor
- Parameters:
entityManager - the EntityManager
setAsText
public void setAsText(java.lang.String text)
throws java.lang.IllegalArgumentException
- Parse the WmId from the given text
- Specified by:
setAsText in interface java.beans.PropertyEditor- Overrides:
setAsText in class java.beans.PropertyEditorSupport
- Throws:
java.lang.IllegalArgumentException
getAsText
public java.lang.String getAsText()
- Format the WmId as String, using the .toString() method of the WmId
implementations.
- Specified by:
getAsText in interface java.beans.PropertyEditor- Overrides:
getAsText in class java.beans.PropertyEditorSupport
- Returns:
- Unique String representation of the WmId
Copyright © 2007-2011 GX Software BV. All Rights Reserved.