Package 

Class CustomTemplate


  • 
    public final class CustomTemplate
    
                        

    A definition of a custom template. Can be a function or a code template. Instances are uniquely identified by their name.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class CustomTemplate.FunctionBuilder

      Builder for CustomTemplate functions. See Builder

      public final class CustomTemplate.TemplateBuilder

      Builder for CustomTemplate code templates. See Builder.

      public class CustomTemplate.Builder

      Builder for CustomTemplates creation. Name and presenter must be set before calling build. Arguments can be specified by using one of the *argument methods. Argument names must be unique. "." characters in template arguments' names denote hierarchical structure. They are treated the same way as the keys within maps passed to mapArgument. If a higher-level name (to the left of a . symbol) matches a map argument's name it is treated the same as if the argument was part of the map itself.

      For example, the following code snippets define identical arguments:

      builder.mapArgument(
          name = "map",
          value = mapOf (
              "a" to 5,
              "b" to 6
          )
      )

      and

      builder.intArgument("map.a", 5)
      builder.intArgument("map.b", 6)

      Methods of this class throw CustomTemplateException for invalid states or parameters. Exceptions of this type are not meant to be caught since defined templates must be correct when the sdk is running. If such an exception is thrown the template definition should be changed instead of handling the error.

    • Method Detail

      • getName

         final String getName()

        The name of the template. Must be unique and non-blank.

      • getIsVisual

         final Boolean getIsVisual()

        Whether the template has UI or not. If set to true the template is registered as part of the in-apps queue and must be explicitly dismissed before other in-apps can be shown. If set to false the template is executed directly and does not require dismissal nor it impedes other in-apps.