Class ApiRegions
java.lang.Object
org.apache.sling.feature.extension.apiregions.api.ApiRegions
Configuration of API regions for Java API.
This class is not thread safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the region.booleanAdd the region.booleanstatic ApiRegionsgetApiRegions(org.apache.sling.feature.Extension ext) Get the api regions from the extension.static ApiRegionsgetApiRegions(org.apache.sling.feature.Feature feature) Get the api regions from the feature - if it exists.getRegionByName(String name) Get a named regionGet the names of the regionsgetRegionsByFeature(org.apache.sling.feature.ArtifactId featureId) getRoot()Get the root regions.inthashCode()booleanisEmpty()Check if any region existsReturn the list of regionsstatic ApiRegionsparse(jakarta.json.JsonArray json) Parse a JSON array into an api regions objectstatic ApiRegionsParse a JSON array into an api regions objecttoJSON()Convert regions into jsonjakarta.json.JsonArrayConvert regions into jsontoString()
-
Field Details
-
EXTENSION_NAME
The name of the api regions extension.- See Also:
-
-
Constructor Details
-
ApiRegions
public ApiRegions()
-
-
Method Details
-
listRegions
Return the list of regions- Returns:
- Unmodifiable list of regions, might be empty
-
getRoot
Get the root regions. The root is the region which does not have a parent- Returns:
- The root region or
null
-
isEmpty
public boolean isEmpty()Check if any region exists- Returns:
trueif it has any region
-
add
Add the region. The region is only added if there isn't already a region with the same name- Parameters:
region- The region to add- Returns:
trueif the region could be added,falseotherwise
-
add
Add the region. The region is only added if there isn't already a region with the same name- Parameters:
idx- The position to addregion- The region to add- Returns:
trueif the region could be added,falseotherwise
-
getRegionByName
Get a named region- Parameters:
name- The name- Returns:
- The region or
null
-
getRegionsByFeature
-
getRegionNames
Get the names of the regions- Returns:
- The list of regions, might be empty
-
toJSONArray
Convert regions into json- Returns:
- The json array
- Throws:
IOException- If generating the JSON fails
-
toJSON
Convert regions into json- Returns:
- The json array as a string
- Throws:
IOException- If generating the JSON fails
-
parse
Parse a JSON array into an api regions object- Parameters:
json- The json as a string- Returns:
- The api regions
- Throws:
IOException- If the json could not be parsed
-
parse
Parse a JSON array into an api regions object- Parameters:
json- The json- Returns:
- The api regions
- Throws:
IOException- If the json could not be parsed
-
getApiRegions
Get the api regions from the feature - if it exists.- Parameters:
feature- The feature- Returns:
- The api regions or
null. - Throws:
IllegalArgumentException- If the extension is wrongly formatted- Since:
- 1.1
-
getApiRegions
Get the api regions from the extension.- Parameters:
ext- The extension- Returns:
- The api regions or
null. - Throws:
IllegalArgumentException- If the extension is wrongly formatted- Since:
- 1.1
-
toString
-
hashCode
public int hashCode() -
equals
-