Deprecated
Deprecated as of 1.3, use StringLookupFactory instead. This class will be removed in 2.0.
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 the values supported by the lookup 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 a ResourceBundle.
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 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 the map, not null.the map of keys to values, may be null. resourceBundle)
References Deprecated
StrLookup is deprecated or references (maybe indirectly) at least one deprecated element.
Returns a lookup which looks up values using a ResourceBundle. |
| 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 for subclasses. | |
| 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.
| |
| resourceBundleLookup | back to summary |
|---|---|
| public static StrLookup References Deprecated
See corresponding docs for further information. Returns a lookup which looks up values using a ResourceBundle. If the ResourceBundle is null, then null will be returned from every lookup. The map result object is converted to a string using toString().
| |
| 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 |
|---|---|
| private | 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 matchthe key to be looked up, may be null key)Implements org. Looks up a String key to a String value using the map. |
| public String |
| map | back to summary |
|---|---|
| private final Map<String, V> map Map keys are variable names and value. | |
| MapStrLookup | back to summary |
|---|---|
| private 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 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(). | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
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 ResourceBundle | resourceBundle
ResourceBundle keys are variable names and value. |
| Access | Constructor and Description |
|---|---|
| private | ResourceBundleLookup(final ResourceBundle
the ResourceBundle of keys to values, may be null. resourceBundle)Creates a new instance backed by a ResourceBundle. |
| Modifier and Type | Method and Description |
|---|---|
| public String | lookup(final String key)
Implements org. Looks up a String key to provide a String value. |
| public String |
| resourceBundle | back to summary |
|---|---|
| private final ResourceBundle resourceBundle ResourceBundle keys are variable names and value. | |
| ResourceBundleLookup | back to summary |
|---|---|
| private ResourceBundleLookup(final ResourceBundle resourceBundle) Creates a new instance backed by a ResourceBundle.
| |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements org. Doc from org. Looks up a String key to provide 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. This method always returns a String, regardless of the underlying data, by converting it as necessary. For example:
Map<String, Object> map = new HashMap<String, Object>();
map.put("number", Integer.valueOf(2));
assertEquals("2", StringLookupFactory.mapStringLookup(map).lookup("number"));
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
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 org. Looks up a String key to provide a String value. |
| SystemPropertiesStrLookup | back to summary |
|---|---|
| private SystemPropertiesStrLookup() Private for Spotbugs SING_SINGLETON_GETTER_NOT_SYNCHRONIZED. | |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements org. Doc from org. Looks up a String key to provide 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. This method always returns a String, regardless of the underlying data, by converting it as necessary. For example:
Map<String, Object> map = new HashMap<String, Object>();
map.put("number", Integer.valueOf(2));
assertEquals("2", StringLookupFactory.mapStringLookup(map).lookup("number"));
This implementation directly accesses system properties.
| |