Class AbstractConverter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean trim  
      private java.lang.Class type  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractConverter​(java.lang.Class type)
      Creates an abstract converter for the specified type.
      protected AbstractConverter​(java.lang.Class type, boolean trim)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAsText()  
      java.lang.Class getType()
      Gets the the type of object supported by this converter.
      java.lang.Object getValue()  
      void setAsText​(java.lang.String text)  
      void setValue​(java.lang.Object value)  
      java.lang.Object toObject​(java.lang.String text)
      Converts the supplied text in to an instance of the editor type.
      protected abstract java.lang.Object toObjectImpl​(java.lang.String text)
      Converts the supplied text in to an instance of the editor type.
      java.lang.String toString​(java.lang.Object value)
      Converts the supplied object to text.
      protected java.lang.String toStringImpl​(java.lang.Object value)
      Converts the supplied object to text.
      • Methods inherited from class java.beans.PropertyEditorSupport

        addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, isPaintable, paintValue, removePropertyChangeListener, setSource, supportsCustomEditor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.beans.PropertyEditor

        addPropertyChangeListener, getCustomEditor, getJavaInitializationString, getTags, isPaintable, paintValue, removePropertyChangeListener, supportsCustomEditor
    • Field Detail

      • type

        private final java.lang.Class type
      • trim

        private final boolean trim
    • Constructor Detail

      • AbstractConverter

        protected AbstractConverter​(java.lang.Class type)
        Creates an abstract converter for the specified type.
        Parameters:
        type - type of the property editor
      • AbstractConverter

        protected AbstractConverter​(java.lang.Class type,
                                    boolean trim)
    • Method Detail

      • getType

        public final java.lang.Class getType()
        Description copied from interface: Converter
        Gets the the type of object supported by this converter.
        Specified by:
        getType in interface Converter
        Returns:
        the type used for that converter.
      • getAsText

        public final java.lang.String getAsText()
        Specified by:
        getAsText in interface java.beans.PropertyEditor
        Overrides:
        getAsText in class java.beans.PropertyEditorSupport
      • setAsText

        public final void setAsText​(java.lang.String text)
        Specified by:
        setAsText in interface java.beans.PropertyEditor
        Overrides:
        setAsText in class java.beans.PropertyEditorSupport
      • getValue

        public final java.lang.Object getValue()
        Specified by:
        getValue in interface java.beans.PropertyEditor
        Overrides:
        getValue in class java.beans.PropertyEditorSupport
      • setValue

        public final void setValue​(java.lang.Object value)
        Specified by:
        setValue in interface java.beans.PropertyEditor
        Overrides:
        setValue in class java.beans.PropertyEditorSupport
      • toString

        public final java.lang.String toString​(java.lang.Object value)
        Description copied from interface: Converter
        Converts the supplied object to text. If value is null, null will be returned. If value is not an instance of the this converter's type, a PropertyEditorException will be thrown.
        Specified by:
        toString in interface Converter
        Parameters:
        value - an instance of the editor type
        Returns:
        the text equivalent of the value
      • toObject

        public final java.lang.Object toObject​(java.lang.String text)
        Description copied from interface: Converter
        Converts the supplied text in to an instance of the editor type. If text is null, null will be returned.
        Specified by:
        toObject in interface Converter
        Parameters:
        text - the text to convert
        Returns:
        an instance of the editor type
      • toStringImpl

        protected java.lang.String toStringImpl​(java.lang.Object value)
        Converts the supplied object to text. The supplied object will always be an instance of the editor type, and specifically will never be null or a String (unless this is the String editor).
        Parameters:
        value - an instance of the editor type
        Returns:
        the text equivalent of the value
      • toObjectImpl

        protected abstract java.lang.Object toObjectImpl​(java.lang.String text)
        Converts the supplied text in to an instance of the editor type. The text will never be null, and trim() will already have been called.
        Parameters:
        text - the text to convert
        Returns:
        an instance of the editor type