Class ValueBuilder

java.lang.Object
org.basex.query.value.ValueBuilder

public final class ValueBuilder extends Object
A builder for efficiently creating a Value by prepending and appending Items and Values.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Constructor Details

    • ValueBuilder

      public ValueBuilder(QueryContext qc)
      Constructor.
      Parameters:
      qc - query context (required for interrupting running queries)
    • ValueBuilder

      public ValueBuilder(QueryContext qc, Item item1, Item item2)
      Constructor with initial items.
      Parameters:
      qc - query context (required for interrupting running queries)
      item1 - first item to append
      item2 - second item to append
  • Method Details

    • concat

      public static Value concat(Value value1, Value value2, QueryContext qc)
      Concatenates two values.
      Parameters:
      value1 - first value to concatenate
      value2 - second value to concatenate
      qc - query context
      Returns:
      concatenated values
    • addFront

      public ValueBuilder addFront(Item item)
      Adds an item to the front of the built value.
      Parameters:
      item - item to add
      Returns:
      reference to this builder for convenience
    • add

      public ValueBuilder add(Item item)
      Appends an item to the built value.
      Parameters:
      item - item to append
      Returns:
      reference to this builder for convenience
    • add

      public ValueBuilder add(Value value)
      Appends a value to the built value.
      Parameters:
      value - value to append
      Returns:
      reference to this builder for convenience
    • value

      public Value value()
      Returns a Value representation of the items currently stored in this builder.
      Returns:
      value
    • value

      public Value value(Type type)
      Returns a Value representation of the items currently stored in this builder annotated with the given item type.
      Parameters:
      type - type (can be null, only considered if new sequence is created)
      Returns:
      value
    • value

      public Value value(Expr expr)
      Returns a Value representation of the items currently stored in this builder annotated with the type of the given expression.
      Parameters:
      expr - expression that created the value (can be null)
      Returns:
      value
    • toString

      public String toString()
      Overrides:
      toString in class Object