code: public String getVariableAsString(String name) {
          TraceState ts = traceState.get();
  
          if (ts != null) {
              Object variable = ts.getVariables().get(name);
              if (log.isLoggable(Level.FINEST)) {
                  log.finest("Get variable '" + name + "' = " + variable);
              }
              return variable == null ? null : variable.toString();
          }
  
          if (log.isLoggable(Level.FINEST)) {
              log.finest("Get variable '" + name + "' requested, but no trace state");
          }
          return null;
      }
docs: This method retrieves a variable associated with the
  current trace.
  
  @return The variable value, or null if not found