001/*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2013 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube 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 * SonarQube 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.wsclient.services;
021
022import javax.annotation.CheckForNull;
023import javax.annotation.Nullable;
024
025public class Dependency extends Model {
026
027  private String id;
028  private Long fromId;
029  private Long toId;
030  private String usage;
031  private Integer weight;
032  private String fromKey;
033  private String fromName;
034  private String fromQualifier;
035  private String toKey;
036  private String toName;
037  private String toQualifier;
038
039  @CheckForNull
040  public String getId() {
041    return id;
042  }
043
044  public Dependency setId(@Nullable String id) {
045    this.id = id;
046    return this;
047  }
048
049  @CheckForNull
050  public Long getFromId() {
051    return fromId;
052  }
053
054  public Dependency setFromId(@Nullable Long fromId) {
055    this.fromId = fromId;
056    return this;
057  }
058
059  @CheckForNull
060  public Long getToId() {
061    return toId;
062  }
063
064  public Dependency setToId(@Nullable Long toId) {
065    this.toId = toId;
066    return this;
067  }
068
069  @CheckForNull
070  public String getFromKey() {
071    return fromKey;
072  }
073
074  public Dependency setFromKey(@Nullable String fromKey) {
075    this.fromKey = fromKey;
076    return this;
077  }
078
079  @CheckForNull
080  public String getToKey() {
081    return toKey;
082  }
083
084  public Dependency setToKey(@Nullable String toKey) {
085    this.toKey = toKey;
086    return this;
087  }
088
089  @CheckForNull
090  public String getUsage() {
091    return usage;
092  }
093
094  public Dependency setUsage(@Nullable String usage) {
095    this.usage = usage;
096    return this;
097  }
098
099  @CheckForNull
100  public Integer getWeight() {
101    return weight;
102  }
103
104  public Dependency setWeight(@Nullable Integer weight) {
105    this.weight = weight;
106    return this;
107  }
108
109  @CheckForNull
110  public String getFromName() {
111    return fromName;
112  }
113
114  public Dependency setFromName(@Nullable String fromName) {
115    this.fromName = fromName;
116    return this;
117  }
118
119  @CheckForNull
120  public String getFromQualifier() {
121    return fromQualifier;
122  }
123
124  public Dependency setFromQualifier(@Nullable String fromQualifier) {
125    this.fromQualifier = fromQualifier;
126    return this;
127  }
128
129  @CheckForNull
130  public String getToName() {
131    return toName;
132  }
133
134  public Dependency setToName(@Nullable String toName) {
135    this.toName = toName;
136    return this;
137  }
138
139  @CheckForNull
140  public String getToQualifier() {
141    return toQualifier;
142  }
143
144  public Dependency setToQualifier(@Nullable String toQualifier) {
145    this.toQualifier = toQualifier;
146    return this;
147  }
148
149  @Override
150  public boolean equals(Object o) {
151    if (this == o) {
152      return true;
153    }
154    if (o == null || getClass() != o.getClass()) {
155      return false;
156    }
157
158    Dependency that = (Dependency) o;
159    return id.equals(that.id);
160  }
161
162  @Override
163  public int hashCode() {
164    return id.hashCode();
165  }
166
167  @Override
168  public String toString() {
169    return new StringBuilder()
170      .append(fromKey)
171      .append(" -> ")
172      .append(toKey)
173      .toString();
174  }
175}