DisplayHelper

public final class DisplayHelper

This helper class is responsible for the parsing of relationship and combobox values to display-friendly formats.

Fields

DTF

public static final DateTimeFormatter DTF

Methods

getDisplayValueForField

public static Object getDisplayValueForField(FieldDto field, Object value)

Parses provided relationship or combobox value to display-friendly format. The type of the value is determined by the field parameter. Depending on the type of the field, a different representation will be returned.

Parameters:
  • field – field definition, that contains the type of the field
  • value – the value to be parsed
Returns:

depending on the field type, it returns String representation for one-to-one relationship Map representation for the one-to-many and many-to-many relationships String or Collection representation for comboboxes, depending on their settings

getDisplayValueForField

public static Object getDisplayValueForField(FieldDto field, Object value, Integer maxLength)

Parses provided relationship or combobox value to display-friendly format. The type of the value is determined by the field parameter. Depending on the type of the field, a different representation will be returned. Moreover, it limits the length of the parsed values, in case they exceed the provided limit.

Parameters:
  • field – field definition, that contains the type of the field
  • value – the value to be parsed
  • maxLength – the number of characters, after which the values will be trimmed; for map representation this is a maximum number of characters for each value in the map
Returns:

depending on the field type, it returns String representation for one-to-one relationship Map representation for the one-to-many and many-to-many relationships String or Collection representation for comboboxes, depending on their settings