Class TextRenderer<T>

    • Constructor Detail

      • TextRenderer

        public TextRenderer()
        Constructor
      • TextRenderer

        public TextRenderer​(String expression)
        Constructor
        Parameters:
        expression - the property expression that will be resolved for the bean supplied to getText(Object)
    • Method Detail

      • getExpression

        public String getExpression()
        Gets the expression supplied to the constructor
        Returns:
        null if the default constructor has been used
      • getTextField

        public String getTextField()
        Description copied from interface: ITextRenderer
        Gets the field name that will represents the 'text' of an object.
        Specified by:
        getTextField in interface ITextRenderer<T>
        Returns:
        the name of the text field
      • getText

        public String getText​(T object)
        Description copied from interface: ITextRenderer
        Gets the text representation of an object.
        Specified by:
        getText in interface ITextRenderer<T>
        Parameters:
        object - the T object
        Returns:
        the text
      • getText

        public String getText​(T object,
                              String expression)
        Description copied from interface: ITextRenderer
        Gets the text representation of an object, for its given property.
        Specified by:
        getText in interface ITextRenderer<T>
        Parameters:
        object - the T object
        expression - the property expression
        Returns:
        the text
      • getFields

        public List<String> getFields()
        Description copied from interface: ITextRenderer
        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)
        Specified by:
        getFields in interface ITextRenderer<T>
        Returns:
        the List of fields
      • render

        public com.github.openjson.JSONObject render​(T object)
        Description copied from interface: ITextRenderer
        Renders the object. This typically returns a JSON body (without brackets)
        Specified by:
        render in interface ITextRenderer<T>
        Parameters:
        object - the object to render
        Returns:
        the rendered object
      • match

        public boolean match​(T object,
                             String search,
                             boolean sensitive)
        Description copied from interface: ITextRenderer
        Indicates whether a search criteria matches the text representation of the supplied object
        Specified by:
        match in interface ITextRenderer<T>
        Parameters:
        object - the T object
        search - the criteria
        sensitive - whether the search is case sensitive or not
        Returns:
        true or false