Class ArrayInsertBefore

java.lang.Object
dev.metaschema.core.metapath.function.library.ArrayInsertBefore

public final class ArrayInsertBefore extends Object
Implements the XPath 3.1 array:insert-before function.
  • Method Details

    • insertBefore

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> insertBefore(@NonNull IArrayItem<T> array, @NonNull IIntegerItem positionItem, @NonNull T member)
      An implementation of XPath 3.1 array:insert-before.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      positionItem - the integer position of the item to insert before
      member - the Metapath item to insert into the identified array
      Returns:
      a new array containing the modification
      Throws:
      NegativeLengthArrayMetapathException - if the position is negative
      IndexOutOfBoundsArrayMetapathException - if the position is not in the range of 1 to array:size
    • insertBefore

      @NonNull public static <T extends ICollectionValue> IArrayItem<T> insertBefore(@NonNull IArrayItem<T> array, int position, @NonNull T member)
      An implementation of XPath 3.1 array:insert-before.
      Type Parameters:
      T - the type of items in the given Metapath array
      Parameters:
      array - the target Metapath array
      position - the integer position of the item to insert before
      member - the Metapath item to insert into the identified array
      Returns:
      a new array containing the modification
      Throws:
      NegativeLengthArrayMetapathException - if the position is negative
      IndexOutOfBoundsArrayMetapathException - if the position is not in the range of 1 to array:size