Class ValueConverterInfoModel<V>

  • Type Parameters:
    V - The type of value represented by the label.
    All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, InfoModel, LabelModel, Model

    public class ValueConverterInfoModel<V>
    extends DefaultInfoModel
    An info model that converts a value to a string for the label. If no label is explicitly set, the label will represent the given value converted to a string using the given converter.
    Author:
    Garret Wilson
    • Constructor Detail

      • ValueConverterInfoModel

        public ValueConverterInfoModel​(V value,
                                       Converter<V,​java.lang.String> converter)
        Value and converter constructor.
        Parameters:
        value - The value to represent as a label.
        converter - The converter to use for displaying the value as a string.
        Throws:
        java.lang.NullPointerException - if the given converter is null.
    • Method Detail

      • getValue

        public final V getValue()
        Returns:
        The represented value.
      • getConverter

        public Converter<V,​java.lang.String> getConverter()
        Returns:
        The converter to use for displaying the value as a string.
      • getLabel

        public java.lang.String getLabel()
        Specified by:
        getLabel in interface LabelModel
        Overrides:
        getLabel in class DefaultLabelModel
        Returns:
        The label text, which may include a resource reference, or null if there is no label text.