org.sonar.api.resources
Class Resource<PARENT extends Resource>

java.lang.Object
  extended by org.sonar.api.resources.Resource<PARENT>
Direct Known Subclasses:
Directory, File, JavaFile, JavaPackage, Library, Method, Project

public abstract class Resource<PARENT extends Resource>
extends Object

The interface to implement to create a resource in Sonar

Since:
1.10

Field Summary
static String QUALIFIER_CLASS
          Deprecated. since 2.6. Use Qualifiers.CLASS.
static String QUALIFIER_DIRECTORY
          Deprecated. since 2.6. Use Qualifiers.DIRECTORY.
static String QUALIFIER_FIELD
          Deprecated. since 2.6. Use Qualifiers.FIELD.
static String QUALIFIER_FILE
          Deprecated. since 2.6. Use Qualifiers.FILE.
static String QUALIFIER_LIB
          Deprecated. since 2.6. Use Qualifiers.LIBRARY.
static String QUALIFIER_METHOD
          Deprecated. since 2.6. Use Qualifiers.METHOD.
static String QUALIFIER_MODULE
          Deprecated. since 2.6. Use Qualifiers.MODULE.
static String QUALIFIER_PACKAGE
          Deprecated. since 2.6. Use Qualifiers.PACKAGE.
static String QUALIFIER_PROJECT
          Deprecated. since 2.6. Use Qualifiers.PROJECT.
static String QUALIFIER_SUBVIEW
          Deprecated. since 2.6. Use Qualifiers.SUBVIEW.
static String QUALIFIER_UNIT_TEST_CLASS
          Deprecated. since 2.6. Use Qualifiers.UNIT_TEST_FILE.
static String QUALIFIER_VIEW
          Deprecated. since 2.6. Use Qualifiers.VIEW.
static String SCOPE_ENTITY
          Deprecated. since 2.6. Use Scopes.FILE.
static String SCOPE_SET
          Deprecated. since 2.6. Use Scopes.PROJECT.
static String SCOPE_SPACE
          Deprecated. since 2.6. Use Scopes.DIRECTORY.
 
Constructor Summary
Resource()
           
 
Method Summary
 boolean equals(Object o)
           
abstract  String getDescription()
           
 String getEffectiveKey()
           
 Integer getId()
           
 String getKey()
           
abstract  Language getLanguage()
           
abstract  String getLongName()
           
abstract  String getName()
           
abstract  PARENT getParent()
          The parent is used to build the resources tree, for example for relations between classes, packages and projects.
abstract  String getQualifier()
           
abstract  String getScope()
           
 int hashCode()
           
 boolean isExcluded()
          Deprecated. since 2.6 should use SensorContext#isExcluded(resource). It will make inheritance of Resource easier.
abstract  boolean matchFilePattern(String antPattern)
          Check resource against an Ant pattern, like mypackag?/*Foo.java.
 Resource setEffectiveKey(String effectiveKey)
          Internal use only
 Resource setExcluded(boolean b)
          Deprecated. since 2.6 should use SensorContext#isExcluded(resource). It will make inheritance of Resource easier.
 Resource setId(Integer id)
          Internal use only
protected  void setKey(String s)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_SET

@Deprecated
public static final String SCOPE_SET
Deprecated. since 2.6. Use Scopes.PROJECT.
See Also:
Constant Field Values

SCOPE_SPACE

@Deprecated
public static final String SCOPE_SPACE
Deprecated. since 2.6. Use Scopes.DIRECTORY.
See Also:
Constant Field Values

SCOPE_ENTITY

@Deprecated
public static final String SCOPE_ENTITY
Deprecated. since 2.6. Use Scopes.FILE.
See Also:
Constant Field Values

QUALIFIER_VIEW

@Deprecated
public static final String QUALIFIER_VIEW
Deprecated. since 2.6. Use Qualifiers.VIEW.
See Also:
Constant Field Values

QUALIFIER_SUBVIEW

@Deprecated
public static final String QUALIFIER_SUBVIEW
Deprecated. since 2.6. Use Qualifiers.SUBVIEW.
See Also:
Constant Field Values

QUALIFIER_LIB

@Deprecated
public static final String QUALIFIER_LIB
Deprecated. since 2.6. Use Qualifiers.LIBRARY.
See Also:
Constant Field Values

QUALIFIER_PROJECT

@Deprecated
public static final String QUALIFIER_PROJECT
Deprecated. since 2.6. Use Qualifiers.PROJECT.
See Also:
Constant Field Values

QUALIFIER_MODULE

@Deprecated
public static final String QUALIFIER_MODULE
Deprecated. since 2.6. Use Qualifiers.MODULE.
See Also:
Constant Field Values

QUALIFIER_PACKAGE

@Deprecated
public static final String QUALIFIER_PACKAGE
Deprecated. since 2.6. Use Qualifiers.PACKAGE.
See Also:
Constant Field Values

QUALIFIER_DIRECTORY

@Deprecated
public static final String QUALIFIER_DIRECTORY
Deprecated. since 2.6. Use Qualifiers.DIRECTORY.
See Also:
Constant Field Values

QUALIFIER_FILE

@Deprecated
public static final String QUALIFIER_FILE
Deprecated. since 2.6. Use Qualifiers.FILE.
See Also:
Constant Field Values

QUALIFIER_CLASS

@Deprecated
public static final String QUALIFIER_CLASS
Deprecated. since 2.6. Use Qualifiers.CLASS.
See Also:
Constant Field Values

QUALIFIER_FIELD

@Deprecated
public static final String QUALIFIER_FIELD
Deprecated. since 2.6. Use Qualifiers.FIELD.
See Also:
Constant Field Values

QUALIFIER_METHOD

@Deprecated
public static final String QUALIFIER_METHOD
Deprecated. since 2.6. Use Qualifiers.METHOD.
See Also:
Constant Field Values

QUALIFIER_UNIT_TEST_CLASS

@Deprecated
public static final String QUALIFIER_UNIT_TEST_CLASS
Deprecated. since 2.6. Use Qualifiers.UNIT_TEST_FILE.
See Also:
Constant Field Values
Constructor Detail

Resource

public Resource()
Method Detail

getKey

public final String getKey()
Returns:
the resource key

setKey

protected void setKey(String s)

getName

public abstract String getName()
Returns:
the resource name

getLongName

public abstract String getLongName()
Returns:
the resource long name

getDescription

public abstract String getDescription()
Returns:
the resource description

getLanguage

public abstract Language getLanguage()
Returns:
the language

getScope

public abstract String getScope()
Returns:
the scope

getQualifier

public abstract String getQualifier()
Returns:
the qualifier

getParent

public abstract PARENT 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.


matchFilePattern

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

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

getId

public final Integer getId()

setId

public Resource setId(Integer id)
Internal use only


getEffectiveKey

public final String getEffectiveKey()

setEffectiveKey

public final Resource setEffectiveKey(String effectiveKey)
Internal use only


isExcluded

@Deprecated
public final boolean isExcluded()
Deprecated. since 2.6 should use SensorContext#isExcluded(resource). It will make inheritance of Resource easier.


setExcluded

@Deprecated
public final Resource setExcluded(boolean b)
Deprecated. since 2.6 should use SensorContext#isExcluded(resource). It will make inheritance of Resource easier.

Internal use only


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009-2011 SonarSource. All Rights Reserved.