@Singleton
public class BlobMetadataToBlobProperties implements Function<BlobMetadata, MutableBlobProperties> {
public MutableBlobProperties apply(BlobMetadata from) {
if (from == null)
return null;
MutableBlobProperties to = new MutableBlobPropertiesImpl();
HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata());
to.setETag(from.getETag());
to.setName(from.getName());
to.setUrl(from.getUri());
to.setLastModified(from.getLastModified());
if (from.getUserMetadata() != null) {
for (Entry<String, String> entry : from.getUserMetadata().entrySet())
to.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
}
return to;
}