Class ResourceType
java.lang.Object
org.apache.sling.api.resource.type.ResourceType
The
ResourceType encapsulates details about a Sling resource type and provides methods for parsing resource type strings.
The following patterns are supported for parsing:
a/b/c- path-baseda/b/c/1.0.0- path-based, versioneda.b.c- Java package namea.b.c/1.0.0- Java package name, versioneda- flat (sub-set of path-based)
-
Method Summary
Modifier and TypeMethodDescriptionboolean@NotNull StringReturns a resource type's label.@NotNull StringgetType()Returns the resource type string, without any version information.@Nullable org.osgi.framework.VersionReturns the version, if available.inthashCode()static @NotNull ResourceTypeparseResourceType(@NotNull String resourceTypeString) Given aresourceTypeString, this method will extract aResourceTypeobject.toString()
-
Method Details
-
getResourceLabel
Returns a resource type's label. The label is important for script selection, since it will provide the name of the main script for this resource type. For more details check the Apache Sling URL to Script Resolution page- Returns:
- the resource type label
-
getType
Returns the resource type string, without any version information.- Returns:
- the resource type string
-
getVersion
@Nullable public @Nullable org.osgi.framework.Version getVersion()Returns the version, if available.- Returns:
- the version, if available;
nullotherwise
-
toString
-
parseResourceType
@NotNull public static @NotNull ResourceType parseResourceType(@NotNull @NotNull String resourceTypeString) Given aresourceTypeString, this method will extract aResourceTypeobject.The accepted patterns are:
a/b/c- path-baseda/b/c/1.0.0- path-based, versioneda.b.c- Java package namea.b.c/1.0.0- Java package name, versioneda- flat (sub-set of path-based)
- Parameters:
resourceTypeString- the resource type string to parse- Returns:
- a
ResourceTypeobject - Throws:
IllegalArgumentException- if theresourceTypeStringcannot be parsed
-
hashCode
public int hashCode() -
equals
-