Interface ITextRenderer<T>

  • Type Parameters:
    T - the model object type
    All Superinterfaces:
    IClusterable, Serializable
    All Known Subinterfaces:
    IChoiceRenderer<T>
    All Known Implementing Classes:
    JsonRenderer, TextRenderer

    public interface ITextRenderer<T>
    extends IClusterable
    Provides the ability to get a specific text (likely from a property) of a bean type, for rendering purpose
    Author:
    Sebastien Briquet - sebfz1
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<String> getFields()
      Gets the list of fields used by this renderer.
      String getText​(T object)
      Gets the text representation of an object.
      String getText​(T object, String expression)
      Gets the text representation of an object, for its given property.
      String getTextField()
      Gets the field name that will represents the 'text' of an object.
      boolean match​(T object, String search, boolean sensitive)
      Indicates whether a search criteria matches the text representation of the supplied object
      com.github.openjson.JSONObject render​(T object)
      Renders the object.
    • Method Detail

      • getTextField

        String getTextField()
        Gets the field name that will represents the 'text' of an object.
        Returns:
        the name of the text field
      • getText

        String getText​(T object)
        Gets the text representation of an object.
        Parameters:
        object - the T object
        Returns:
        the text
      • getText

        String getText​(T object,
                       String expression)
        Gets the text representation of an object, for its given property.
        Parameters:
        object - the T object
        expression - the property expression
        Returns:
        the text
      • getFields

        List<String> getFields()
        Gets the list of fields used by this renderer. This can be used to prevent duplication on rendering (if a template uses same fields for instance)
        Returns:
        the List of fields
      • match

        boolean match​(T object,
                      String search,
                      boolean sensitive)
        Indicates whether a search criteria matches the text representation of the supplied object
        Parameters:
        object - the T object
        search - the criteria
        sensitive - whether the search is case sensitive or not
        Returns:
        true or false
      • render

        com.github.openjson.JSONObject render​(T object)
        Renders the object. This typically returns a JSON body (without brackets)
        Parameters:
        object - the object to render
        Returns:
        the rendered object