Package org.apache.sling.fsprovider.internal.mapper

# Class FileResource

java.lang.Object
org.apache.sling.api.adapter.SlingAdaptable
org.apache.sling.api.resource.AbstractResource
org.apache.sling.fsprovider.internal.mapper.FileResource

All Implemented Interfaces:
  `org.apache.sling.api.adapter.Adaptable`, `org.apache.sling.api.resource.Resource`

@Adaptable(adaptableClass=org.apache.sling.api.resource.Resource.class,adapters={@Adapter({java.io.File.class,java.net.URL.class,org.apache.sling.api.resource.ValueMap.class}),@Adapter(value=java.io.InputStream.class,condition="If the adaptable is a FileResource and is a readable file."),@Adapter(value=javax.jcr.Node.class,condition="If the adaptable is a FileResource and is providing content in JSON or FileVault XML format.")}) public final class FileResource extends org.apache.sling.api.resource.AbstractResource
The `FileResource` represents a file system file or folder as a Sling Resource.

## Field Summary

### Fields inherited from interface org.apache.sling.api.resource.Resource

`RESOURCE_TYPE_NON_EXISTING`

## Method Summary

Modifier and Type
Method
Description
`<AdapterType>
AdapterType`
`adaptTo(@NotNull Class<AdapterType> type)`
Returns an adapter for this resource.
`@NotNull String`
`getPath()`
Returns the path of this resource
`@NotNull org.apache.sling.api.resource.ResourceMetadata`
`getResourceMetadata()`
Returns the resource meta data for this resource containing the file length, last modification time and the resource path (same as `getPath()`).
`@NotNull org.apache.sling.api.resource.ResourceResolver`
`getResourceResolver()`
Returns the resource resolver which cause this resource object to be created.
`String`
`getResourceSuperType()`
`@NotNull String`
`getResourceType()`
`org.apache.sling.api.resource.ValueMap`
`getValueMap()`
`String`
`toString()`

### Methods inherited from class org.apache.sling.api.resource.AbstractResource

`getChild, getChildren, getName, getParent, hasChildren, isResourceType, listChildren`

### Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable

`setAdapterManager, unsetAdapterManager`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Method Details

### getPath

@NotNull public @NotNull String getPath()
Returns the path of this resource

### getResourceMetadata

@NotNull public @NotNull org.apache.sling.api.resource.ResourceMetadata getResourceMetadata()
Returns the resource meta data for this resource containing the file length, last modification time and the resource path (same as `getPath()`).

### getResourceResolver

@NotNull public @NotNull org.apache.sling.api.resource.ResourceResolver getResourceResolver()
Returns the resource resolver which cause this resource object to be created.

### getResourceSuperType

public String getResourceSuperType()

### getResourceType

@NotNull public @NotNull String getResourceType()

### adaptTo

@Nullable public <AdapterType> AdapterType adaptTo(@NotNull @NotNull Class<AdapterType> type)
Returns an adapter for this resource. This implementation supports `File`, `InputStream` and `URL` plus those supported by the adapter manager.

Specified by:
  `adaptTo` in interface `org.apache.sling.api.adapter.Adaptable`
Overrides:
  `adaptTo` in class `org.apache.sling.api.adapter.SlingAdaptable`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getValueMap

public org.apache.sling.api.resource.ValueMap getValueMap()

Specified by:
  `getValueMap` in interface `org.apache.sling.api.resource.Resource`
Overrides:
  `getValueMap` in class `org.apache.sling.api.resource.AbstractResource`