@Singleton
public class ListOptionsToListBlobsOptions implements
Function<ListContainerOptions, ListBlobsOptions> {
public ListBlobsOptions apply(ListContainerOptions from) {
checkNotNull(from, "set options to instance NONE instead of passing null");
ListBlobsOptions httpOptions = new ListBlobsOptions();
if (!from.isRecursive()) {
httpOptions.delimiter("/");
}
if (from.getDir() != null) {
httpOptions.prefix(from.getDir().endsWith("/") ? from.getDir() : from.getDir() + "/");
}
if (from.getMarker() != null) {
httpOptions.marker(from.getMarker());
}
if (from.getMaxResults() != null) {
httpOptions.maxResults(from.getMaxResults());
}
if (from.isDetailed()) {
httpOptions.includeMetadata();
}
return httpOptions;
}