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
Modifier and Type
Class
Description
`class`
`PathTrie.Node`

## Constructor Summary

Constructors
Constructor
Description
`PathTrie()`
`PathTrie(Set<String> reserved)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`attachValueToNode(PathTrie<T>.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 Details

### PathTrie

public PathTrie()

### PathTrie

public PathTrie(Set<String> reserved)

## Method Details

### 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<T>.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.