001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 SonarSource SA
004 * mailto:info AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.batch;
021
022import java.util.Collection;
023import org.sonar.api.measures.Formula;
024import org.sonar.api.measures.FormulaData;
025import org.sonar.api.measures.Measure;
026import org.sonar.api.measures.MeasuresFilter;
027import org.sonar.api.measures.Metric;
028
029/**
030 * @since 1.11
031 * @deprecated since 5.2. Aggregation of measures is provided by {@link org.sonar.api.ce.measure.MeasureComputer}. {@link org.sonar.api.batch.Decorator}
032 * and {@link Formula} are no more supported.
033 */
034@Deprecated
035public class DefaultFormulaData implements FormulaData {
036
037  public DefaultFormulaData(DecoratorContext unused) {
038  }
039
040  @Override
041  public Measure getMeasure(Metric metric) {
042    throw fail();
043  }
044
045  @Override
046  public <M> M getMeasures(MeasuresFilter<M> filter) {
047    throw fail();
048  }
049
050  @Override
051  public Collection<Measure> getChildrenMeasures(MeasuresFilter filter) {
052    throw fail();
053  }
054
055  @Override
056  public Collection<Measure> getChildrenMeasures(Metric metric) {
057    throw fail();
058  }
059
060  @Override
061  public Collection<FormulaData> getChildren() {
062    throw fail();
063  }
064
065  private static RuntimeException fail() {
066    throw new UnsupportedOperationException(
067      "Unsupported since version 5.2. Decorators and formulas are not used anymore for aggregation measures. Please use org.sonar.api.ce.measure.MeasureComputer.");
068  }
069}