001/* 002 * SonarQube 003 * Copyright (C) 2009-2018 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.component.mock; 021 022import org.sonar.api.component.SourceFile; 023 024/** 025 * @deprecated since 5.6 026 */ 027@Deprecated 028public class MockSourceFile implements SourceFile { 029 private String key; 030 private String path; 031 private String qualifier; 032 private String language; 033 private String name; 034 private String longName; 035 036 private MockSourceFile() { 037 } 038 039 @Override 040 public String key() { 041 return key; 042 } 043 044 public MockSourceFile setKey(String key) { 045 this.key = key; 046 return this; 047 } 048 049 @Override 050 public String path() { 051 return path; 052 } 053 054 public MockSourceFile setPath(String path) { 055 this.path = path; 056 return this; 057 } 058 059 @Override 060 public String qualifier() { 061 return qualifier; 062 } 063 064 public MockSourceFile setQualifier(String qualifier) { 065 this.qualifier = qualifier; 066 return this; 067 } 068 069 public String language() { 070 return language; 071 } 072 073 public MockSourceFile setLanguage(String language) { 074 this.language = language; 075 return this; 076 } 077 078 @Override 079 public String name() { 080 return name; 081 } 082 083 public MockSourceFile setName(String name) { 084 this.name = name; 085 return this; 086 } 087 088 @Override 089 public String longName() { 090 return longName; 091 } 092 093 public MockSourceFile setLongName(String longName) { 094 this.longName = longName; 095 return this; 096 } 097 098 @Override 099 public boolean equals(Object o) { 100 if (this == o) { 101 return true; 102 } 103 if (o == null || getClass() != o.getClass()) { 104 return false; 105 } 106 107 MockSourceFile that = (MockSourceFile) o; 108 return !(key != null ? !key.equals(that.key) : (that.key != null)); 109 } 110 111 @Override 112 public int hashCode() { 113 return key != null ? key.hashCode() : 0; 114 } 115 116 public static MockSourceFile createMain(String key) { 117 return new MockSourceFile().setKey(key).setQualifier("FIL"); 118 } 119}