Class TemplateVariables


  • public final class TemplateVariables
    extends java.lang.Object
    Holds information about variables found in template file. Can be used to validate template data.

    A variable path looks like the following. A.B.C[].D

    A path is a string that contains tokens separated with . (dot) characters. The tokens represents keys in maps.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TemplateVariables fromPaths​(java.util.Collection<java.lang.String> allVariablePaths, java.util.Collection<java.lang.String> allFragmentNames)  
      java.util.Set<java.lang.String> getAllFragmentNames()  
      java.util.Set<java.lang.String> getAllVariables()
      Returns all variable paths as an immutable set.
      void throwWhenInvalid​(TemplateData templateData)
      Throws IllegalArgumentException exception when template data is missing values for schema.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromPaths

        public static TemplateVariables fromPaths​(java.util.Collection<java.lang.String> allVariablePaths,
                                                  java.util.Collection<java.lang.String> allFragmentNames)
      • getAllVariables

        public java.util.Set<java.lang.String> getAllVariables()
        Returns all variable paths as an immutable set.
      • getAllFragmentNames

        public java.util.Set<java.lang.String> getAllFragmentNames()
      • throwWhenInvalid

        public void throwWhenInvalid​(TemplateData templateData)
                              throws java.lang.IllegalArgumentException
        Throws IllegalArgumentException exception when template data is missing values for schema.

        Throws when referred keys are missing from data.

        Throws:
        java.lang.IllegalArgumentException - then parameter does not match pattern
        java.lang.NullPointerException - when parameter is null.