code: public static String getContextStringProperty(SensorContext context, String name, String def) {
      String s = context.config().get(name).orElse(null);
      if (s == null || s.isEmpty()) {
        return def;
      }
      return s;
    }
docs: Get string property from configuration. If the string is not set or empty, return the default value.
  
  @param context sensor context
  @param name Name of the property
  @param def Default value
  @return Value of the property if set and not empty, else default value.