Package org.jboss.msc.service
Class ServiceNameMapper<V>
- java.lang.Object
-
- org.jboss.msc.service.ServiceNameMapper<V>
-
public final class ServiceNameMapper<V> extends java.lang.Object
A mapper for service names which allows a service name or pattern to be correlated with a value. If more than one pattern matches a service name, the best match is chosen; if there are multiple best matches then an arbitrary one is selected.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ServiceNameMapper.Node<V>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object
ANY
The special marker which represents a pattern match.private ServiceNameMapper.Node<V>
root
-
Constructor Summary
Constructors Constructor Description ServiceNameMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
doRegisterMatcher(java.lang.Object[] segments, int idx, V value, ServiceNameMapper.Node<V> current)
private V
match(java.lang.String[] segments, int idx, ServiceNameMapper.Node<V> current)
V
match(ServiceName serviceName)
Attempt to match a service name.void
registerMatcher(V value, java.lang.Object... segments)
Register a matcher for a specific location.
-
-
-
Field Detail
-
ANY
public static final java.lang.Object ANY
The special marker which represents a pattern match.
-
root
private final ServiceNameMapper.Node<V> root
-
-
Method Detail
-
registerMatcher
public void registerMatcher(V value, java.lang.Object... segments)
Register a matcher for a specific location.- Parameters:
value
- the value to registersegments
- the segments to match
-
doRegisterMatcher
private void doRegisterMatcher(java.lang.Object[] segments, int idx, V value, ServiceNameMapper.Node<V> current)
-
match
public V match(ServiceName serviceName)
Attempt to match a service name.- Parameters:
serviceName
- the service name- Returns:
- the value result, or
null
if no match was found
-
match
private V match(java.lang.String[] segments, int idx, ServiceNameMapper.Node<V> current)
-
-