> +
> +      ContentMetadata metadata = from.getContentMetadata();
> +      String contentDisposition = metadata.getContentDisposition();
> +      String contentEncoding = metadata.getContentEncoding();
> +      String contentLanguage = metadata.getContentLanguage();
> +      String contentType = metadata.getContentType();
> +      Long contentLength = metadata.getContentLength();
> +
> +      HashCode md5 = metadata.getContentMD5AsHashCode();
> +
> +      if (md5 != null) {
> +         return new 
> ObjectTemplate().contentType(contentType).size(contentLength).contentEncoding(contentEncoding)
> +                  
> .contentLanguage(contentLanguage).contentDisposition(contentDisposition).name(name).md5Hash(md5)
> +                  .customMetadata(userMeta);
> +      }
> +      return new 
> ObjectTemplate().contentType(contentType).size(contentLength).contentEncoding(contentEncoding)

Can you avoid duplicated code with:

```
ObjectTemplate template = new ObjectTemplate().contentType(...)...;
if (md5 != null) {
    template.md5Hash(md5);
}
return template;
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/48/files#r17210180

Reply via email to