Class AbstractConverter<V,​L>

    • Field Summary

      • Fields inherited from class com.globalmentor.beans.BoundPropertyObject

        NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getInvalidValueMessage()  
      boolean isEquivalent​(V value, L literal)
      Determines if the given literal in the lexical space is a valid representation of the given value in the value space.
      boolean isValidLiteral​(L literal)
      Determines whether a given literal value in the lexical space can be converted to a value in the value space.
      void setInvalidValueMessage​(java.lang.String newInvalidValueMessage)
      Sets the text of the invalid value message.
      • Methods inherited from class com.globalmentor.beans.BoundPropertyObject

        addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
    • Constructor Detail

      • AbstractConverter

        public AbstractConverter()
    • Method Detail

      • getInvalidValueMessage

        public java.lang.String getInvalidValueMessage()
        Specified by:
        getInvalidValueMessage in interface Converter<V,​L>
        Returns:
        The invalid value message text, which may include a resource reference.
      • setInvalidValueMessage

        public void setInvalidValueMessage​(java.lang.String newInvalidValueMessage)
        Description copied from interface: Converter
        Sets the text of the invalid value message. This is a bound property.
        Specified by:
        setInvalidValueMessage in interface Converter<V,​L>
        Parameters:
        newInvalidValueMessage - The new text of the invalid value message, which may include a resource reference.
        See Also:
        Converter.INVALID_VALUE_MESSAGE_PROPERTY
      • isValidLiteral

        public boolean isValidLiteral​(L literal)
        Determines whether a given literal value in the lexical space can be converted to a value in the value space.

        This implementation attempts to convert the literal value and returns false if conversion is unsuccessful.

        Specified by:
        isValidLiteral in interface Converter<V,​L>
        Parameters:
        literal - The literal value to validate.
        Returns:
        true if the literal is valid, else false.
      • isEquivalent

        public boolean isEquivalent​(V value,
                                    L literal)
        Determines if the given literal in the lexical space is a valid representation of the given value in the value space.

        This implementation assumes that non- null values can correctly be compared using Object.equals(Object).

        Specified by:
        isEquivalent in interface Converter<V,​L>
        Parameters:
        value - The value to compare.
        literal - The literal value in the lexical space to compare with the value after conversion.
        Returns:
        true if the given literal in the lexical space is a valid representation of the given value in the value space.