class MutableSpan implements Cloneable {

  @Nullable static String normalizeIdField(String field, @Nullable String id, boolean isNullable) {
    if (id == null) {
      if (isNullable) return null;
      throw new NullPointerException(field + " == null");
    }
    int length = id.length();
    if (length == 0) {
      if (isNullable) return null;
      throw new IllegalArgumentException(field + " is empty");
    }
    int desiredLength = field.equals("traceId") && length > 16 ? 32 : 16;
    int existingPadding = validateHexAndReturnPadding(field, id, desiredLength);
    if (desiredLength == 32 && existingPadding >= 16) { // overly padded traceId
      return id.substring(16);
    }
    return length == desiredLength ? id : padLeft(id, desiredLength, existingPadding);
  }

  public  MutableSpan();
  public  MutableSpan(TraceContext context, @Nullable MutableSpan defaults);
  public  MutableSpan(MutableSpan toCopy);

}