org.sonar.api.resources
Class JavaPackage

java.lang.Object
  extended by org.sonar.api.resources.Resource
      extended by org.sonar.api.resources.JavaPackage

public class JavaPackage
extends Resource

A class that represents a Java package in Sonar

Since:
1.10

Field Summary
static String DEFAULT_PACKAGE_NAME
          Default package name for classes without package definition
 
Fields inherited from class org.sonar.api.resources.Resource
QUALIFIER_CLASS, QUALIFIER_DIRECTORY, QUALIFIER_FIELD, QUALIFIER_FILE, QUALIFIER_LIB, QUALIFIER_METHOD, QUALIFIER_MODULE, QUALIFIER_PACKAGE, QUALIFIER_PROJECT, QUALIFIER_SUBVIEW, QUALIFIER_UNIT_TEST_CLASS, QUALIFIER_VIEW, SCOPE_ENTITY, SCOPE_SET, SCOPE_SPACE
 
Constructor Summary
JavaPackage()
          Defaul constructor
JavaPackage(String key)
          Creates a JavaPackage from its key.
 
Method Summary
 String getDescription()
          
 Language getLanguage()
           
 String getLongName()
          
 String getName()
          
 Resource<?> getParent()
          The parent is used to build the resources tree, for example for relations between classes, packages and projects.
 String getQualifier()
           
 String getScope()
           
 boolean isDefault()
           
 boolean matchFilePattern(String antPattern)
          Check resource against an Ant pattern, like mypackag?/*Foo.java.
 String toString()
           
 
Methods inherited from class org.sonar.api.resources.Resource
equals, getEffectiveKey, getId, getKey, hashCode, isExcluded, setEffectiveKey, setExcluded, setId, setKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PACKAGE_NAME

public static final String DEFAULT_PACKAGE_NAME
Default package name for classes without package definition

See Also:
Constant Field Values
Constructor Detail

JavaPackage

public JavaPackage()
Defaul constructor


JavaPackage

public JavaPackage(String key)
Creates a JavaPackage from its key. Will use DEFAULT_PACKAGE_NAME if key is null

Method Detail

isDefault

public boolean isDefault()
Returns:
whether the JavaPackage key is the defult key

matchFilePattern

public boolean matchFilePattern(String antPattern)
Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example to match resource exclusions.

Specified by:
matchFilePattern in class Resource
Parameters:
antPattern - Ant-like pattern (with **, * and ?). It includes file suffixes.
Returns:
true if the resource matches the Ant pattern

getDescription

public String getDescription()

Specified by:
getDescription in class Resource
Returns:
the resource description

getScope

public String getScope()
Specified by:
getScope in class Resource
Returns:
SCOPE_SPACE

getQualifier

public String getQualifier()
Specified by:
getQualifier in class Resource
Returns:
QUALIFIER_PACKAGE

getName

public String getName()

Specified by:
getName in class Resource
Returns:
the resource name

getParent

public Resource<?> getParent()
The parent is used to build the resources tree, for example for relations between classes, packages and projects.

Return null if the parent is the project.

Specified by:
getParent in class Resource

getLongName

public String getLongName()

Specified by:
getLongName in class Resource
Returns:
the resource long name

getLanguage

public Language getLanguage()
Specified by:
getLanguage in class Resource
Returns:
Java

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2011 SonarSource. All Rights Reserved.