Deprecated
As of 3.6, use Apache Commons Text StringLookupFactory.
This class represents the simplest form of a string to string map. It has a benefit over a map in that it can create the result on demand based on the key.
This class comes complete with various factory methods. If these do not suffice, you can subclass and implement your own matcher.
For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value on demand from the database.
| Modifier and Type | Class and Description |
|---|---|
| private static class | StrLookup.
the type of mapped values. V>
References Deprecated
Lookup implementation that uses a Map.
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private static class | StrLookup.
References Deprecated
Lookup implementation based on system properties.
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Modifier and Type | Field and Description |
|---|---|
| private static final StrLookup | NONE_LOOKUP
References Deprecated
Lookup that always returns null.
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
|
| private static final StrLookup | SYSTEM_PROPERTIES_LOOKUP
References Deprecated
Lookup based on system properties.
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract String | |
| public static < the type of the values supported by the lookup. V> StrLookup | |
| public static StrLookup | Returns: a lookup that always returns null, not null.
References Deprecated
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
Returns a lookup which always returns null. |
| public static StrLookup | Returns: a lookup using system properties, not null.
References Deprecated
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
Returns a new lookup which uses a copy of the current
|
| NONE_LOOKUP | back to summary |
|---|---|
| private static final StrLookup<String> NONE_LOOKUP
References Deprecated
See corresponding docs for further information. Lookup that always returns null. | |
| SYSTEM_PROPERTIES_LOOKUP | back to summary |
|---|---|
| private static final StrLookup<String> SYSTEM_PROPERTIES_LOOKUP
References Deprecated
See corresponding docs for further information. Lookup based on system properties. | |
| StrLookup | back to summary |
|---|---|
| protected StrLookup() Constructs a new instance. | |
| lookup | back to summary |
|---|---|
| public abstract String lookup(String key) Looks up a String key to a String value. The internal implementation may use any mechanism to return the value. The simplest implementation is to use a Map. However, virtually any implementation is possible. For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value on demand from the database Or, a numeric based implementation could be created that treats the key as an integer, increments the value and return the result as a string - converting 1 to 2, 15 to 16 etc.
The
| |
| mapLookup | back to summary |
|---|---|
| public static <V> StrLookup References Deprecated
See corresponding docs for further information. Returns a lookup which looks up values using a map. If the map is null, then null will be returned from every lookup. The map result object is converted to a string using toString(). | |
| noneLookup | back to summary |
|---|---|
| public static StrLookup References Deprecated
See corresponding docs for further information. Returns a lookup which always returns null.
| |
| systemPropertiesLookup | back to summary |
|---|---|
| public static StrLookup References Deprecated
See corresponding docs for further information. Returns a new lookup which uses a copy of the current
If a security manager blocked access to system properties, then null will be returned from every lookup. If a null key is used, this lookup will throw a NullPointerException. | |
References Deprecated
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| private final Map | map
Map keys are variable names and value. |
| Access | Constructor and Description |
|---|---|
| pack-priv | MapStrLookup(final Map<String, V>
the map of keys to values, may be null. map)Creates a new instance backed by a Map. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the matching value, null if no match.the key to be looked up, may be null. key)Implements abstract org. Looks up a String key to a String value using the map. |
| map | back to summary |
|---|---|
| private final Map<String, V> map Map keys are variable names and value. | |
| MapStrLookup | back to summary |
|---|---|
| pack-priv MapStrLookup(final Map<String, V> map) Creates a new instance backed by a Map. | |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements abstract org. Looks up a String key to a String value using the map. If the map is null, then null is returned. The map result object is converted to a string using toString(). | |
References Deprecated
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
See corresponding docs for further information.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public String | lookup(final String key)
Implements abstract org. Looks up a String key to a String value. |
| SystemPropertiesStrLookup | back to summary |
|---|---|
| private SystemPropertiesStrLookup() | |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements abstract org. Doc from org. Looks up a String key to a String value. The internal implementation may use any mechanism to return the value. The simplest implementation is to use a Map. However, virtually any implementation is possible. For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value on demand from the database Or, a numeric based implementation could be created that treats the key as an integer, increments the value and return the result as a string - converting 1 to 2, 15 to 16 etc.
The This implementation directly accesses system properties.
| |