Class IfHelper

  • All Implemented Interfaces:
    Helper<Object>

    public class IfHelper
    extends Object
    implements Helper<Object>
    You can use the if helper to conditionally render a block. If its argument returns false, null or empty list/array (a "falsy" value), Handlebars will not render the block.
    Since:
    0.3.0
    • Constructor Detail

      • IfHelper

        public IfHelper()
    • Method Detail

      • apply

        public CharSequence apply​(Object context,
                                  Options options)
                           throws IOException
        Description copied from interface: Helper
        Apply the helper to the context.
        Specified by:
        apply in interface Helper<Object>
        Parameters:
        context - The context object.
        options - The options object.
        Returns:
        A string result.
        Throws:
        IOException - If a template cannot be loaded.