Package org.apache.solr.common.util

## Class PathTrie<T>

- java.lang.Object
- - org.apache.solr.common.util.PathTrie<T>

    public class PathTrie<T>
    extends Object

A utility class to efficiently parse/store/lookup hierarchical paths which are templatized like /collections/{collection}/shards/{shard}/{replica}

### Nested Class Summary

Nested Classes
`class` `PathTrie.Node`

### Constructor Summary

Constructors
`PathTrie()`
`PathTrie​(Set<String> reserved)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `attachValueToNode​(PathTrie.Node node, T o)` Attaches the provided object to the PathTrie node
`static List<String>` `getPathSegments​(String path)`
`void` `insert​(String path, Map<String,​String> replacements, T o)`
`void` `insert​(List<String> parts, Map<String,​String> replacements, T o)`
`T` `lookup​(String path, Map<String,​String> templateValues)`
`T` `lookup​(String path, Map<String,​String> templateValues, Set<String> paths)`
`T` `lookup​(List<String> path, Map<String,​String> templateValues)`
`T` `remove​(List<String> path)`
`static void` `replaceTemplates​(List<String> parts, Map<String,​String> replacements)`
`static String` `templateName​(String templateStr)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PathTrie

    public PathTrie()

#### PathTrie

    public PathTrie​(Set<String> reserved)

### Method Detail

#### insert

    public void insert​(String path,
                       Map<String,​String> replacements,
                       T o)

#### insert

    public void insert​(List<String> parts,
                       Map<String,​String> replacements,
                       T o)

#### replaceTemplates

    public static void replaceTemplates​(List<String> parts,
                                        Map<String,​String> replacements)

#### getPathSegments

    public static List<String> getPathSegments​(String path)

#### remove

    public T remove​(List<String> path)

#### lookup

    public T lookup​(String path,
                    Map<String,​String> templateValues)

#### lookup

    public T lookup​(List<String> path,
                    Map<String,​String> templateValues)

#### lookup

    public T lookup​(String path,
                    Map<String,​String> templateValues,
                    Set<String> paths)

#### templateName

    public static String templateName​(String templateStr)

#### attachValueToNode

    protected void attachValueToNode​(PathTrie.Node node,
                                     T o)

Attaches the provided object to the PathTrie node

The default implementation overwrites any existing values, but this can be overwritten by subclasses.