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.ce.measure; 021 022/** 023 * Measure used in {@link MeasureComputer} 024 * 025 * @since 5.2 026 */ 027public interface Measure { 028 029 /** 030 * The value of this measure as a integer. 031 * 032 * @throws IllegalStateException if the value type of the metric is not an Integer as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass} 033 * To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}). 034 */ 035 int getIntValue(); 036 037 /** 038 * The value of this measure as a long. 039 * 040 * @throws IllegalStateException if the value type of the metric is not a Long as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass} 041 * To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}). 042 */ 043 long getLongValue(); 044 045 /** 046 * The value of this measure as a double. 047 * 048 * @throws IllegalStateException if the value type of the metric is not a Double as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}. 049 * To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}). 050 */ 051 double getDoubleValue(); 052 053 /** 054 * The value of this measure as a string. 055 * 056 * @throws IllegalStateException if the value type of the metric is not a String as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass} 057 * To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}). 058 */ 059 String getStringValue(); 060 061 /** 062 * The value of this measure as a boolean. 063 * 064 * @throws IllegalStateException if the value type of the metric is not a Boolean as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass} 065 * To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}). 066 */ 067 boolean getBooleanValue(); 068 069}