001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2008-2011 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar 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 * Sonar 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 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.server.filters; 021 022 import org.apache.commons.lang.builder.ReflectionToStringBuilder; 023 import org.apache.commons.lang.builder.ToStringStyle; 024 025 public class MeasureCriterion { 026 027 private Integer metricId; 028 private String operator; 029 private Double value; 030 private Boolean variation; 031 032 public MeasureCriterion(Integer metricId, String operator, Double value, Boolean variation) { 033 this.metricId = metricId; 034 this.operator = operator; 035 this.value = value; 036 this.variation = variation; 037 } 038 039 public Integer getMetricId() { 040 return metricId; 041 } 042 043 public void setMetricId(Integer metricId) { 044 this.metricId = metricId; 045 } 046 047 public String getOperator() { 048 return operator; 049 } 050 051 public void setOperator(String operator) { 052 this.operator = operator; 053 } 054 055 public Double getValue() { 056 return value; 057 } 058 059 public void setValue(Double value) { 060 this.value = value; 061 } 062 063 public boolean isVariation() { 064 return variation==Boolean.TRUE; 065 } 066 067 public MeasureCriterion setVariation(Boolean b) { 068 this.variation = b; 069 return this; 070 } 071 072 @Override 073 public String toString() { 074 return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString(); 075 } 076 }