Class ValueConverterInfoModel<V>

java.lang.Object
com.globalmentor.beans.BoundPropertyObject
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 Details

    • ValueConverterInfoModel

      public ValueConverterInfoModel(V value, Converter<V,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:
      NullPointerException - if the given converter is null.
  • Method Details

    • getValue

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

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

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