public static ExtractFromRow extractParentPath ( final int indexInRow , final NodeCache cache , TypeSystem types ) { final TypeFactory < Path > type = types . getPathFactory ( ) ; final boolean trace = NodeSequence . LOGGER . isTraceEnabled ( ) ; return new ExtractFromRow ( ) { @ Override public TypeFactory < Path > getType ( ) { return type ; } @ Override public Object getValueInRow ( RowAccessor row ) { CachedNode node = row . getNode ( indexInRow ) ; if ( node == null ) return null ; NodeKey parentKey = node . getParentKey ( cache ) ; if ( parentKey == null ) return null ; CachedNode parent = cache . getNode ( parentKey ) ; if ( parent == null ) return null ; Path parentPath = parent . getPath ( cache ) ; if ( trace ) NodeSequence . LOGGER . trace ( "Extracting parent path from {0}: {1}" , node . getPath ( cache ) , parentPath ) ; return parentPath ; } @ Override public String toString ( ) { return "(extract-parent-path)" ; } } ; }
Create an extractor that extracts the parent path from the node at the given position in the row .