public class ContextTransformer extends Object implements org.apache.commons.collections.Transformer
ContextTransformer is a Transformer implementation that traverses a Map
of Maps to find the value related to the specified key.
This implementation first checks the context map for the explicit key. If the key exists, it returns the value associated with it. If the key does not exist and appears to represent a path via "/"-delimited keys (configurations/service-site/property_name), the path is traversed recursively looking for the requested data.
Example context:
|- services : [set of services] | |- configurations | |- service-site | | |- property : [value] | |- key/looks/like/path : [value2]
services, [set of services] would be returnedconfigurations/service-site/property, value would be returnedconfigurations/service-site, [map of service-site properties] would be returnedkey/looks/like/path, value2 would be returned| Constructor and Description |
|---|
ContextTransformer(String key)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
getKey()
Returns the key this transformer is using to search for data
|
int |
hashCode() |
Object |
transform(Object o) |
public ContextTransformer(String key)
key - the key to search forCopyright © 2022 Apache Software Foundation. All rights reserved.