Enum Class Templates.TemplateLoadStrategy

java.lang.Object
java.lang.Enum<Templates.TemplateLoadStrategy>
io.jstach.jstachio.spi.Templates.TemplateLoadStrategy
All Implemented Interfaces:
Serializable, Comparable<Templates.TemplateLoadStrategy>, Constable
Enclosing class:
Templates

Strategy to load templates dynamically. These strategies expect the exact type and not a super type!
Author:
agentgt
  • Enum Constant Details

  • Method Details

    • values

      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • load

      protected abstract <T> @Nullable Template<T> load(Class<T> clazz, ClassLoader classLoader, System.Logger logger) throws Exception
      Load the template by this strategy.
      Type Parameters:
      T - model type.
      Parameters:
      clazz - model type.
      classLoader - classload which may more may not be used.
      logger - used to log reflection warnings or other errors.
      Returns:
      loaded template
      Throws:
      Exception - if an error happens while trying to load template.
    • isEnabled

      protected abstract boolean isEnabled(JStachioConfig config)
      Determine if the strategy is enabled.
      Parameters:
      config - key value config
      Returns:
      true if not disabled.