TagLibAdapter (Groovy 5.0.6)

Package: groovy.text.markup

## [Groovy] Class TagLibAdapter

- groovy.text.markup.TagLibAdapter

-     class TagLibAdapter
      extends Object

  Adapts Grails taglibs for use in the template engine. An adapter may be created like this:

           def model = [:]
           def tpl = template.make(model)
           model.g = new TagLibAdapter(tpl)
           model.g.registerTagLib(SimpleTagLib)

  where SimpleTagLib is:

           class SimpleTagLib {
              def emoticon = { attrs, body ->
                  out << body() << (attrs.happy == 'true' ? " :-)" : " :-(")
              }
           }

  Then it can be used inside a template like this:

           g.emoticon(happy:'true') { 'Hi John' }

  Performance-wise, it would be better to reimplement the taglib, but this makes it easier to reuse existing code.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `TagLibAdapter(BaseTemplate tpl)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `methodMissing(String name, Object args)`
    `` | `void` | `registerTagLib(Class tagLibClass)`
    `` | `void` | `registerTagLib(Object tagLib)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TagLibAdapter(BaseTemplate tpl)

  - ### Method Detail

    - #### @SuppressWarnings(value: Instanceof)
      Object methodMissing(String name, Object args)

    - #### @SuppressWarnings(value: UnnecessaryGetter)
      void registerTagLib(Class tagLibClass)

    - #### void registerTagLib(Object tagLib)