Class 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-24, BSD License, Leo Woerteler
    • Constructor Detail

      • ValueBuilder

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

      • 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
      • concat

        public static Value concat​(Item item1,
                                   Item item2)
        Concatenates two items.
        Parameters:
        item1 - first item to concatenate
        item2 - second item to concatenate
        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 (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