code: public String   build(ServiceInstance<?> serviceInstance, Map<String, Object> variables)
      {
          Map<String, Object>     localVariables = Maps.newHashMap();
          localVariables.put(FIELD_OPEN_BRACE, "{");
          localVariables.put(FIELD_CLOSE_BRACE, "}");
          localVariables.put(FIELD_SCHEME, "http");
  
          if ( serviceInstance != null )
          {
              localVariables.put(FIELD_NAME, nullCheck(serviceInstance.getName()));
              localVariables.put(FIELD_ID, nullCheck(serviceInstance.getId()));
              localVariables.put(FIELD_ADDRESS, nullCheck(serviceInstance.getAddress()));
              localVariables.put(FIELD_PORT, nullCheck(serviceInstance.getPort()));
              localVariables.put(FIELD_SSL_PORT, nullCheck(serviceInstance.getSslPort()));
              localVariables.put(FIELD_REGISTRATION_TIME_UTC, nullCheck(serviceInstance.getRegistrationTimeUTC()));
              localVariables.put(FIELD_SERVICE_TYPE, (serviceInstance.getServiceType() != null) ? serviceInstance.getServiceType().name().toLowerCase() : "");
              if ( serviceInstance.getSslPort() != null )
              {
                  localVariables.put(FIELD_SCHEME, "https");
              }
          }
  
          localVariables.putAll(variables);
  
          StringBuilder       str = new StringBuilder();
          for ( Part p : parts )
          {
              if ( p.isVariable() )
              {
                  Object value = localVariables.get(p.getValue());
                  if ( value == null )
                  {
                      log.debug("Variable not found: " + p.getValue());
                  }
                  else
                  {
                      str.append(value);
                  }
              }
              else
              {
                  str.append(p.getValue());
              }
          }
  
          return str.toString();
      }
docs: Build into a UriSpec string
  
  @param serviceInstance instance to use for pre-defined replacement fields
  @param variables a mapping of field replacement names to values. Note: any fields listed
  in this map override pre-defined fields
  @return UriSpec string