java.lang.Object
com.aoapps.net.partialurl.PartialURLMap<V>
Maps
partial URLs to arbitrary values and provides fast lookups.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(FieldSource fieldSource) Gets the value associated with the given URL, returning the most specific match.voidput(PartialURL partialUrl, V value) Adds a new partial URL to this map while checking for conflicts.
-
Constructor Details
-
PartialURLMap
public PartialURLMap()
-
-
Method Details
-
put
Adds a new partial URL to this map while checking for conflicts.TODO: Use
MinimalMapin the index?Implementation Note:
Currently, when an exception occurs, the index may be in a partial state. Changes are not rolled-back.- Throws:
IllegalStateException- If the partial URL conflicts with an existing entry.
-
get
Gets the value associated with the given URL, returning the most specific match.Ordering is consistent with:
PartialURL.matches(com.aoapps.net.partialurl.FieldSource)PartialURL.getCombinations()SinglePartialURL.compareTo(com.aoapps.net.partialurl.SinglePartialURL)
Implementation Note:
The maximum number of internal map lookups is:(host, null) * (contextPath, null) * (maxSlashCount + 1) * (scheme, null) * (port, null), or2 * 2 * (maxSlashCount + 1) * 2 * 2, or16 * (maxSlashCount + 1). The actual number of map lookups will typically be much less than this due to a sparsely populated index.- Returns:
- The matching value or
nullof no match - Throws:
MalformedURLException
-
