Package 

Class CustomTemplate.Builder


  • 
    public class CustomTemplate.Builder<P extends CustomTemplatePresenter<?>, T extends CustomTemplate.Builder<P, T>>
    
                        

    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.