code: public static MetricDto transformToDto(Metric metric) {
          if (metric == null) {
              throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
          }
  
          MetricDto result = createDtoObject(MetricDto.class, metric);
  
          return result;
      }
docs: Converts a metric entity to a DTO.
  
  @param   metric  The metric to convert.
  
  @return  The corresponding DTO.
  
  @throws  WebApplicationException  If an error occurs.