public static ExtractFromRow extractRelativePath ( final int indexInRow , final Path relativePath , final NodeCache cache , TypeSystem types ) { CheckArg . isNotNull ( relativePath , "relativePath" ) ; 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 ; Path nodePath = node . getPath ( cache ) ; try { Path path = nodePath . resolve ( relativePath ) ; if ( trace ) NodeSequence . LOGGER . trace ( "Extracting relative path {2} from {0}: {2}" , node . getPath ( cache ) , relativePath , path ) ; return path ; } catch ( InvalidPathException e ) { return null ; } } @ Override public String toString ( ) { return "(extract-relative-path)" ; } } ; }
Create an extractor that extracts the path from the node at the given position in the row and applies the relative path .