org.sonar.api.resources
Class ResourceType

java.lang.Object
  extended by org.sonar.api.resources.ResourceType

@Beta
@Immutable
public final class ResourceType
extends Object

Experimental extension to declare types of resources.

Since 3.0, ResourceType object can declare properties that give information about the capabilities of the resource type. Those properties may be used, of instance, to adapt the Web UI according to the type of the resource being displayed.
Currently, the following properties can be defined:

Since:
2.14

Nested Class Summary
static class ResourceType.Builder
          Builder used to create ResourceType objects.
 
Method Summary
static ResourceType.Builder builder(String qualifier)
          Creates a new ResourceType.Builder
 boolean equals(Object o)
           
 Boolean getBooleanProperty(String key)
          Returns the value of the property for this resource type.
 String getIconPath()
          Returns the relative path of the icon used to represent the resource type
 String getQualifier()
          Qualifier is the unique key.
 String getStringProperty(String key)
          Returns the value of the property for this resource type.
 int hashCode()
           
 boolean hasSourceCode()
          Tells whether resources of this type has source code or not.
 boolean isAvailableForFilters()
          Deprecated. since 3.0. Use getBooleanProperty(String) with "availableForFilters".
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

builder

public static ResourceType.Builder builder(String qualifier)
Creates a new ResourceType.Builder

Parameters:
qualifier -

getQualifier

public String getQualifier()
Qualifier is the unique key.

Returns:
the qualifier

getIconPath

public String getIconPath()
Returns the relative path of the icon used to represent the resource type

Returns:
the relative path.

isAvailableForFilters

@Deprecated
public boolean isAvailableForFilters()
Deprecated. since 3.0. Use getBooleanProperty(String) with "availableForFilters".


hasSourceCode

public boolean hasSourceCode()
Tells whether resources of this type has source code or not.

Returns:
true if the type has source code

getStringProperty

public String getStringProperty(String key)
Returns the value of the property for this resource type.

Returns:
the String value of the property, or NULL if the property hasn't been set.
Since:
3.0

getBooleanProperty

public Boolean getBooleanProperty(String key)
Returns the value of the property for this resource type.

Returns:
the Boolean value of the property. If the property hasn't been set, False is returned.
Since:
3.0

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009-2012 SonarSource. All Rights Reserved.