diff options
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/resources')
5 files changed, 39 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java index ef8d85d630f..9a44724c909 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java @@ -42,34 +42,42 @@ public class Directory extends Resource { this.language = language; } + @Override public String getName() { return getKey(); } + @Override public String getLongName() { return null; } + @Override public String getDescription() { return null; } + @Override public Language getLanguage() { return language; } + @Override public String getScope() { return Scopes.DIRECTORY; } + @Override public String getQualifier() { return Qualifiers.DIRECTORY; } + @Override public Resource getParent() { return null; } + @Override public boolean matchFilePattern(String antPattern) { WildcardPattern matcher = WildcardPattern.create(antPattern, "/"); return matcher.match(getKey()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java index b547f72559a..eaa8090bfd7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java @@ -96,6 +96,7 @@ public class File extends Resource<Directory> { * * @see Resource#getParent() */ + @Override public Directory getParent() { if (parent == null) { parent = new Directory(directoryKey); @@ -118,6 +119,7 @@ public class File extends Resource<Directory> { * * @see Resource#matchFilePattern(String) */ + @Override public boolean matchFilePattern(String antPattern) { WildcardPattern matcher = WildcardPattern.create(antPattern, "/"); return matcher.match(getKey()); @@ -146,6 +148,7 @@ public class File extends Resource<Directory> { * * @see Resource#getName() */ + @Override public String getName() { return filename; } @@ -155,6 +158,7 @@ public class File extends Resource<Directory> { * * @see Resource#getLongName() */ + @Override public String getLongName() { return getKey(); } @@ -164,6 +168,7 @@ public class File extends Resource<Directory> { * * @see Resource#getDescription() */ + @Override public String getDescription() { return null; } @@ -173,6 +178,7 @@ public class File extends Resource<Directory> { * * @see Resource#getLanguage() */ + @Override public Language getLanguage() { return language; } @@ -187,6 +193,7 @@ public class File extends Resource<Directory> { /** * @return SCOPE_ENTITY */ + @Override public final String getScope() { return SCOPE; } @@ -196,6 +203,7 @@ public class File extends Resource<Directory> { * * @return QUALIFIER_UNIT_TEST_CLASS */ + @Override public String getQualifier() { return qualifier; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java index 634c5c96c20..cd142ae6ce2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java @@ -105,6 +105,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * {@inheritDoc} */ + @Override public JavaPackage getParent() { if (parent == null) { parent = new JavaPackage(packageKey); @@ -116,6 +117,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * @return null */ + @Override public String getDescription() { return null; } @@ -123,6 +125,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * @return Java */ + @Override public Language getLanguage() { return Java.INSTANCE; } @@ -130,6 +133,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * {@inheritDoc} */ + @Override public String getName() { return filename; } @@ -137,6 +141,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * {@inheritDoc} */ + @Override public String getLongName() { return longName; } @@ -144,6 +149,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * @return SCOPE_ENTITY */ + @Override public String getScope() { return Scopes.FILE; } @@ -151,6 +157,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * @return QUALIFIER_UNIT_TEST_CLASS or QUALIFIER_CLASS depending whether it is a unit test class */ + @Override public String getQualifier() { return unitTest ? Qualifiers.UNIT_TEST_FILE : Qualifiers.CLASS; } @@ -165,6 +172,7 @@ public class JavaFile extends Resource<JavaPackage> { /** * {@inheritDoc} */ + @Override public boolean matchFilePattern(String antPattern) { if (unitTest) { return false; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java index 5fb874e88d7..cc2623151e9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java @@ -58,6 +58,7 @@ public class JavaPackage extends Resource { /** * {@inheritDoc} */ + @Override public boolean matchFilePattern(String antPattern) { return false; } @@ -65,6 +66,7 @@ public class JavaPackage extends Resource { /** * {@inheritDoc} */ + @Override public String getDescription() { return null; } @@ -72,6 +74,7 @@ public class JavaPackage extends Resource { /** * @return SCOPE_SPACE */ + @Override public String getScope() { return Scopes.DIRECTORY; } @@ -79,6 +82,7 @@ public class JavaPackage extends Resource { /** * @return QUALIFIER_PACKAGE */ + @Override public String getQualifier() { return Qualifiers.PACKAGE; } @@ -86,6 +90,7 @@ public class JavaPackage extends Resource { /** * {@inheritDoc} */ + @Override public String getName() { return getKey(); } @@ -93,6 +98,7 @@ public class JavaPackage extends Resource { /** * {@inheritDoc} */ + @Override public Resource<?> getParent() { return null; } @@ -100,6 +106,7 @@ public class JavaPackage extends Resource { /** * {@inheritDoc} */ + @Override public String getLongName() { return null; } @@ -107,6 +114,7 @@ public class JavaPackage extends Resource { /** * @return Java */ + @Override public Language getLanguage() { return Java.INSTANCE; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java index 366332d90b4..7edac70d88d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java @@ -154,14 +154,17 @@ public class Project extends Resource { return packaging; } + @Override public String getName() { return name; } + @Override public String getLongName() { return name; } + @Override public String getDescription() { return description; } @@ -243,6 +246,7 @@ public class Project extends Resource { /** * @return the project language */ + @Override public Language getLanguage() { return language; } @@ -286,6 +290,7 @@ public class Project extends Resource { /** * @return the scope of the current object */ + @Override public String getScope() { return Scopes.PROJECT; } @@ -293,6 +298,7 @@ public class Project extends Resource { /** * @return the qualifier of the current object */ + @Override public String getQualifier() { return isRoot() ? Qualifiers.PROJECT : Qualifiers.MODULE; } @@ -302,6 +308,7 @@ public class Project extends Resource { return false; } + @Override public Project getParent() { return parent; } |