Interface Converter<V,​L>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String INVALID_VALUE_MESSAGE_PROPERTY
      The invalid value message bound property.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      V convertLiteral​(L literal)
      Converts a literal representation of a value from the lexical space into a value in the value space.
      L convertValue​(V value)
      Converts a value from the value space to a literal value in the lexical space.
      java.lang.String getInvalidValueMessage()  
      GuiseSession getSession()  
      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 interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
    • Field Detail

      • INVALID_VALUE_MESSAGE_PROPERTY

        static final java.lang.String INVALID_VALUE_MESSAGE_PROPERTY
        The invalid value message bound property.
    • Method Detail

      • getInvalidValueMessage

        java.lang.String getInvalidValueMessage()
        Returns:
        The invalid value message text, which may include a resource reference.
      • setInvalidValueMessage

        void setInvalidValueMessage​(java.lang.String newInvalidValueMessage)
        Sets the text of the invalid value message. This is a bound property.
        Parameters:
        newInvalidValueMessage - The new text of the invalid value message, which may include a resource reference.
        Throws:
        java.lang.NullPointerException - if the given message is null.
        See Also:
        INVALID_VALUE_MESSAGE_PROPERTY
      • getSession

        GuiseSession getSession()
        Returns:
        The Guise session that owns this converter.
      • convertLiteral

        V convertLiteral​(L literal)
                  throws ConversionException
        Converts a literal representation of a value from the lexical space into a value in the value space.
        Parameters:
        literal - The literal value in the lexical space to convert.
        Returns:
        The converted value in the value space, or null if the given literal is null.
        Throws:
        ConversionException - if the literal value cannot be converted.
      • convertValue

        L convertValue​(V value)
                throws ConversionException
        Converts a value from the value space to a literal value in the lexical space.
        Parameters:
        value - The value in the value space to convert.
        Returns:
        The converted value in the lexical space, or null if the given literal is null.
        Throws:
        ConversionException - if the value cannot be converted.
      • isValidLiteral

        boolean isValidLiteral​(L literal)
        Determines whether a given literal value in the lexical space can be converted to a value in the value space.
        Parameters:
        literal - The literal value to validate.
        Returns:
        true if the literal is valid, else false.
      • isEquivalent

        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.
        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.