Package org.sonar.api.resources
Class ResourceType
- java.lang.Object
-
- org.sonar.api.resources.ResourceType
-
@Immutable public class ResourceType extends java.lang.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:- "deletable": if set to "true", then this resource can be deleted/purged.
- "supportsMeasureFilters": if set to "true", then this resource can be displayed in measure filters
- "modifiable_history": if set to "true", then the history of this resource may be modified (deletion of snapshots, modification of events, ...)
- "updatable_key" (since 3.2): if set to "true", then it is possible to update the key of this resource
- "supportsGlobalDashboards" (since 3.2): if true, this resource can be displayed in global dashboards
- "hasRolePolicy" : if true, roles configuration is available in sidebar
- "comparable" (since 3.4) : if true, the resource can be compared to other resources
- "configurable" (since 3.6) : if true, the settings page can be displayed on the resource
- Since:
- 2.14
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceType.Builder
Builder used to createResourceType
objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResourceType.Builder
builder(java.lang.String qualifier)
Creates a newResourceType.Builder
boolean
equals(java.lang.Object o)
boolean
getBooleanProperty(java.lang.String key)
Returns the value of the property for this resource type.java.lang.String
getIconPath()
Returns the relative path of the icon used to represent the resource typejava.lang.String
getQualifier()
Qualifier is the unique key.java.lang.String
getStringProperty(java.lang.String key)
Returns the value of the property for this resource type.int
hashCode()
boolean
hasProperty(java.lang.String key)
boolean
hasSourceCode()
Tells whether resources of this type has source code or not.java.lang.String
toString()
-
-
-
Method Detail
-
getQualifier
public java.lang.String getQualifier()
Qualifier is the unique key.- Returns:
- the qualifier
-
getIconPath
public java.lang.String getIconPath()
Returns the relative path of the icon used to represent the resource type- Returns:
- the relative path.
-
hasSourceCode
public boolean hasSourceCode()
Tells whether resources of this type has source code or not.- Returns:
- true if the type has source code
-
hasProperty
public boolean hasProperty(java.lang.String key)
-
getStringProperty
public java.lang.String getStringProperty(java.lang.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(java.lang.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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
builder
public static ResourceType.Builder builder(java.lang.String qualifier)
Creates a newResourceType.Builder
-
-