Class 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.
    • Field Detail

      • ANY

        public static final java.lang.Object ANY
        The special marker which represents a pattern match.
    • Constructor Detail

      • ServiceNameMapper

        public ServiceNameMapper()
    • Method Detail

      • registerMatcher

        public void registerMatcher​(V value,
                                    java.lang.Object... segments)
        Register a matcher for a specific location.
        Parameters:
        value - the value to register
        segments - 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