public static String buildPath ( JsonPath jsonPath ) { List < String > urlParts = new LinkedList <> ( ) ; JsonPath currentJsonPath = jsonPath ; String pathPart ; do { if ( currentJsonPath instanceof RelationshipsPath ) { pathPart = RELATIONSHIP_MARK + SEPARATOR + currentJsonPath . getElementName ( ) ; } else if ( currentJsonPath instanceof FieldPath ) { pathPart = currentJsonPath . getElementName ( ) ; } else { pathPart = currentJsonPath . getElementName ( ) ; if ( currentJsonPath . getIds ( ) != null ) { pathPart += SEPARATOR + mergeIds ( currentJsonPath . getIds ( ) ) ; } } urlParts . add ( pathPart ) ; currentJsonPath = currentJsonPath . getParentResource ( ) ; } while ( currentJsonPath != null ) ; Collections . reverse ( urlParts ) ; return SEPARATOR + StringUtils . join ( SEPARATOR , urlParts ) + SEPARATOR ; }
Creates a path using the provided JsonPath structure .