Interface TextTemplateModel

    • Method Detail

      • get

        <T> T get​(String key,
                  Class<T> type)
        Retrieve the given model item, of the given type.

        If there is no model item with the given key, null is returned.

        If the model item with the given key is assignment compatible with the given type it is returned.

        If the model item is NOT assignment compatible with the given type, an IllegalArgumentException will be thrown.

        Note: generic types are completely ignored for assignment compatiblity, due to Java's type erasure.

        Type Parameters:
        T - the target type of the model item
        Parameters:
        key - the model item key
        type - the target type of the model item
        Returns:
        the model item
      • get

        <T> T get​(String key,
                  com.google.common.reflect.TypeToken<T> type)
        Retrieve the given model item, of the given type.

        If there is no model item with the given key, null is returned.

        If the model item with the given key is assignment compatible with the given type it is returned.

        If the model item is NOT assignment compatible with the given type, an IllegalArgumentException will be thrown.

        Note: generic types are completely ignored for assignment compatiblity, due to Java's type erasure.

        Type Parameters:
        T - the target type of the model item
        Parameters:
        key - the model item key
        type - the target type of the model item
        Returns:
        the model item