@ProviderType
public interface ResourceBuilder
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_PRIMARY_TYPE
Default primary type for resources created by this builder
|
Modifier and Type | Method and Description |
---|---|
@NotNull ResourceBuilder |
atParent()
Reset the current parent Resource to the original one.
|
@NotNull ResourceBuilder |
commit()
Commit created resources
|
@NotNull ResourceBuilder |
file(@NotNull java.lang.String filename,
@NotNull java.io.InputStream data)
Create a file under the current parent resource.
|
@NotNull ResourceBuilder |
file(@NotNull java.lang.String filename,
@NotNull java.io.InputStream data,
@Nullable java.lang.String mimeType,
long lastModified)
Create a file under the current parent resource
|
@NotNull org.apache.sling.api.resource.Resource |
getCurrentParent()
Return the current parent resource
|
@NotNull ResourceBuilder |
hierarchyMode()
Set hierarchy mode (as opposed to siblings mode) where creating a resource
sets it as the current parent.
|
@NotNull ResourceBuilder |
resource(@NotNull java.lang.String path,
@NotNull java.util.Map<java.lang.String,java.lang.Object> properties)
Create a Resource, which optionally becomes the current
parent Resource.
|
@NotNull ResourceBuilder |
resource(@NotNull java.lang.String path,
java.lang.Object... properties)
Create a Resource, which optionally becomes the current
parent Resource.
|
@NotNull ResourceBuilder |
siblingsMode()
Set siblings mode (as opposed to hierarchy mode) where creating a resource
doesn't change the current parent.
|
@NotNull ResourceBuilder |
withIntermediatePrimaryType(@Nullable java.lang.String primaryType)
Set the primary type for intermediate resources created
when the parent of resource being created does not exist.
|
static final java.lang.String DEFAULT_PRIMARY_TYPE
@NotNull @NotNull ResourceBuilder resource(@NotNull @NotNull java.lang.String path, @NotNull java.lang.Object... properties)
path
- The path of the Resource to create.
If it's a relative path this builder's current resource is used as parent.
Otherwise the resource is created ad the given absolute path.properties
- optional name-value pairs@NotNull @NotNull ResourceBuilder resource(@NotNull @NotNull java.lang.String path, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> properties)
path
- The path of the Resource to create.
If it's a relative path this builder's current resource is used as parent.
Otherwise the resource is created ad the given absolute path.properties
- Name-value pairs@NotNull @NotNull ResourceBuilder file(@NotNull @NotNull java.lang.String filename, @NotNull @NotNull java.io.InputStream data, @Nullable @Nullable java.lang.String mimeType, long lastModified)
filename
- The name of the created filedata
- The file datamimeType
- If null, use the Sling MimeTypeService to set the mime typelastModified
- if < 0, current time is used@NotNull @NotNull ResourceBuilder file(@NotNull @NotNull java.lang.String filename, @NotNull @NotNull java.io.InputStream data)
filename
- The name of the created filedata
- The file data@NotNull @NotNull ResourceBuilder commit()
@NotNull @NotNull ResourceBuilder withIntermediatePrimaryType(@Nullable @Nullable java.lang.String primaryType)
primaryType
- If null the DEFAULT_PRIMARY_TYPE is used.@NotNull @NotNull ResourceBuilder siblingsMode()
@NotNull @NotNull ResourceBuilder hierarchyMode()
@NotNull @NotNull org.apache.sling.api.resource.Resource getCurrentParent()
@NotNull @NotNull ResourceBuilder atParent()
Copyright © 2014–2021 wcm.io. All rights reserved.