Interface DownloadTarget
-
@ProviderType public interface DownloadTarget
Specifies an entity that should be included in a download initiated through the
DownloadService
.Depending on its
type
, a target will be routed to aDownloadTargetProcessor
implementation, which will use the target'sparameters
to retrieve one or more binary URIs to include in the download. The parameters are flexible and specific to the type of target.For example, assume there is an target whose type is "asset". A parameter applicable to this type might be a "path", whose value would be the sling path to the asset. The target would go through a
DownloadTargetProcessor
designed to handle assets, and the implementation would include the asset's original rendition URI as the binary to include in the download. Alternatively, the processor might return URIs for all of the asset's renditions, which would be an example of a single target generating multiple URIs.- See Also:
DownloadService
,DownloadManifest
,DownloadTargetProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getParameter(java.lang.String parameterName, java.lang.Class<T> clazz)
Retrieves one of the target's parameters by name.<T> T
getParameter(java.lang.String parameterName, T defaultValue)
Retrieves one of the target's parameters by name.java.lang.String[]
getParameterNames()
Retrieves the names of all parameters included in the target.java.lang.String
getType()
Retrieves the target's type, which is primarily used to send the target through itsDownloadTargetProcessor
.
-
-
-
Method Detail
-
getType
java.lang.String getType()
Retrieves the target's type, which is primarily used to send the target through itsDownloadTargetProcessor
.- Returns:
- The target's type.
-
getParameter
<T> T getParameter(java.lang.String parameterName, java.lang.Class<T> clazz)
Retrieves one of the target's parameters by name. The value will be converted to the specified type.- Type Parameters:
T
- Target type for the parameter value.- Parameters:
parameterName
- The name of the parameter whose value to retrieve.clazz
- The type to which that the parameter's value will be converted.- Returns:
- The given parameter's value.
-
getParameter
<T> T getParameter(java.lang.String parameterName, T defaultValue)
Retrieves one of the target's parameters by name. If the parameter doesn't have a value then the method will return the given default value instead. The parameter value will be converted to the specified type.- Type Parameters:
T
- Target type for the parameter value.- Parameters:
parameterName
- The name of the parameter whose value to retrieve.defaultValue
- Value to return if the parameter has no value.- Returns:
- The given parameter's value, or the given defalt value.
-
getParameterNames
java.lang.String[] getParameterNames()
Retrieves the names of all parameters included in the target.- Returns:
- Parameter names.
-
-