Class TemplateFormatterImpl<T extends FormatterSupport>

    • Method Detail

      • format

        public String format​(T reference)
        replace attributes from template by attribute values from the map. missing template attributes will be ignored and doesn't add to result at all.
        Specified by:
        format in interface TemplateFormatter<T extends FormatterSupport>
        Parameters:
        reference - must not be null
        Returns:
        completed template
      • createFormatter

        public static <F extends FormatterSupport> TemplateFormatter<F> createFormatter​(String template,
                                                                                        Class<F> sourceType)
        The created TemplateFormatter provide only usage of simple expression language with squared brackets.
        Parameters:
        template - must not be null
        sourceType - must not be null
        Returns:
        TemplateFormatter which using template and lexer which was forwarded
      • createFormatter

        public static <F extends FormatterSupport> TemplateFormatter<F> createFormatter​(String template,
                                                                                        Class<F> sourceType,
                                                                                        boolean strict)
        The created TemplateFormatter provide only usage of simple expression language with squared brackets.
        Parameters:
        template - must not be null
        sourceType - must not be null
        strict - use strict mode for pattern matching (only match exact name) instead of best fitting
        Returns:
        TemplateFormatter which using template and lexer which was forwarded
      • createFormatter

        public static <F extends FormatterSupport> TemplateFormatter<F> createFormatter​(String template,
                                                                                        F source,
                                                                                        boolean strict)
        Parameters:
        template - must not be null
        source - must not be null
        strict - use strict mode for pattern matching (only match exact name) instead of best fitting
        Returns:
        TemplateFormatter
      • createFormatter

        public static <F extends FormatterSupport> TemplateFormatter<F> createFormatter​(String template,
                                                                                        Lexer<F> lexer,
                                                                                        boolean strict)
        Parameters:
        template - must not be null
        lexer - must not be null
        strict - use strict mode for pattern matching (only match exact name) instead of best fitting
        Returns:
        TemplateFormatter which using template and lexer which was forwarded