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 a
DownloadTargetProcessor implementation, which will use the target's
parameters 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:
-
Method Summary
Modifier and TypeMethodDescription<T> TgetParameter(String parameterName, Class<T> clazz) Retrieves one of the target's parameters by name.<T> TgetParameter(String parameterName, T defaultValue) Retrieves one of the target's parameters by name.String[]Retrieves the names of all parameters included in the target.getType()Retrieves the target's type, which is primarily used to send the target through itsDownloadTargetProcessor.
-
Method Details
-
getType
String getType()Retrieves the target's type, which is primarily used to send the target through itsDownloadTargetProcessor.- Returns:
- The target's type.
-
getParameter
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
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
String[] getParameterNames()Retrieves the names of all parameters included in the target.- Returns:
- Parameter names.
-