Class FaunaTemplate.TemplatePart

  • Enclosing class:
    FaunaTemplate

    public static final class FaunaTemplate.TemplatePart
    extends java.lang.Object
    Represents a part of the template, which can either be a literal string or a variable placeholder.
    • Constructor Summary

      Constructors 
      Constructor Description
      TemplatePart​(java.lang.String part, TemplatePartType type)
      Constructs a new TemplatePart with the specified text and type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPart()
      Retrieves the text of this part of the template.
      TemplatePartType getType()
      Retrieves the type of this part of the template.
      QueryFragment toFragment​(java.util.Map<java.lang.String,​java.lang.Object> args)
      Converts this template part to a QueryFragment using the given arguments.
      • Methods inherited from class java.lang.Object

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

      • TemplatePart

        public TemplatePart​(java.lang.String part,
                            TemplatePartType type)
        Constructs a new TemplatePart with the specified text and type.
        Parameters:
        part - the text for this part of the template, either literal text or a variable.
        type - the type of this part of the template, either TemplatePartType.LITERAL or TemplatePartType.VARIABLE.
    • Method Detail

      • getPart

        public java.lang.String getPart()
        Retrieves the text of this part of the template.
        Returns:
        the text for this template part.
      • getType

        public TemplatePartType getType()
        Retrieves the type of this part of the template.
        Returns:
        the type of this template part, either literal or variable.
      • toFragment

        public QueryFragment toFragment​(java.util.Map<java.lang.String,​java.lang.Object> args)
        Converts this template part to a QueryFragment using the given arguments. If this part is a variable, the argument map is checked for a corresponding key, returning an appropriate QueryFragment. If no matching argument is found, an exception is thrown.
        Parameters:
        args - the map of arguments for template substitution.
        Returns:
        a QueryFragment representing this template part.
        Throws:
        java.lang.IllegalArgumentException - if required arguments are missing.