Class ContentFile
- java.lang.Object
-
- org.apache.sling.fsprovider.internal.mapper.ContentFile
-
public final class ContentFile extends Object
Reference to a file that contains a content fragment (e.g. JSON, JCR XML).
-
-
Constructor Summary
Constructors Constructor Description ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache)ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache, ContentType contentType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<Map.Entry<String,ContentElement>>getChildren()ContentElementgetContent()Content object referenced by sub path.FilegetFile()StringgetPath()StringgetSubPath()org.apache.sling.api.resource.ValueMapgetValueMap()booleanhasContent()ContentFilenavigateToAbsolute(String newSubPath)Navigate to another sub path position in content file.ContentFilenavigateToRelative(String newSubPath)Navigate to another sub path position in content file.
-
-
-
Constructor Detail
-
ContentFile
public ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache)
- Parameters:
file- File with content fragmentpath- Root path of the content filesubPath- Relative path addressing content fragment inside filecontentFileCache- Content file cache
-
ContentFile
public ContentFile(File file, String path, String subPath, ContentFileCache contentFileCache, ContentType contentType)
- Parameters:
file- File with content fragmentpath- Root path of the content filesubPath- Relative path addressing content fragment inside filecontentFileCache- Content file cachecontentType- Content type
-
-
Method Detail
-
getFile
public File getFile()
- Returns:
- File with content fragment
-
getPath
public String getPath()
- Returns:
- Root path of content file
-
getSubPath
public String getSubPath()
- Returns:
- Relative path addressing content fragment inside file
-
getContent
public ContentElement getContent()
Content object referenced by sub path.- Returns:
- Map if resource, property value if property.
-
hasContent
public boolean hasContent()
- Returns:
- true if any content was found.
-
getValueMap
public org.apache.sling.api.resource.ValueMap getValueMap()
- Returns:
- ValueMap for resource. Never null.
-
getChildren
public Iterator<Map.Entry<String,ContentElement>> getChildren()
- Returns:
- Child maps.
-
navigateToAbsolute
public ContentFile navigateToAbsolute(String newSubPath)
Navigate to another sub path position in content file.- Parameters:
newSubPath- New sub path related to root path of content file- Returns:
- Content file
-
navigateToRelative
public ContentFile navigateToRelative(String newSubPath)
Navigate to another sub path position in content file.- Parameters:
newSubPath- New sub path relative to current sub path in content file- Returns:
- Content file
-
-