Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

MetricDtoToMetric.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * SonarQube, open source software quality management tool.
  3. * Copyright (C) 2008-2014 SonarSource
  4. * mailto:contact AT sonarsource DOT com
  5. *
  6. * SonarQube is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * SonarQube is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.server.computation.metric;
  21. import com.google.common.base.Function;
  22. import javax.annotation.Nonnull;
  23. import org.sonar.db.metric.MetricDto;
  24. enum MetricDtoToMetric implements Function<MetricDto, Metric> {
  25. INSTANCE;
  26. @Override
  27. @Nonnull
  28. public Metric apply(@Nonnull MetricDto metricDto) {
  29. return new MetricImpl(
  30. metricDto.getId(), metricDto.getKey(), metricDto.getShortName(), Metric.MetricType.valueOf(metricDto.getValueType()),
  31. metricDto.getBestValue(), metricDto.isOptimizedBestValue());
  32. }
  33. }