package common.pages;

import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Image;

public class ImageData extends Base {

    private final Image image;

    private ImageData(final Image image) {
        this.image = image;
    }

    public static ImageData of(final Image image) {
        return new ImageData(image);
    }

    public String getThumbImage() {
        return nullIfEmpty(image.getUrl());
    }

    public String getBigImage() {
        return nullIfEmpty(image.getUrl());
    }

    public String getPlaceholderImage() {
        return "http://placehold.it/350x150";
    }

    private String nullIfEmpty(final String s) {
        if(s.isEmpty())
            return null;
        else
            return s;
    }
}

@@ -86,16 +86,80 @@
 Image;%0A%0A
+import static org.apache.commons.lang3.StringUtils.trimToNull;%0A%0A
 public c
@@ -442,35 +442,34 @@
      return 
-nullIfEmpty
+trimToNull
 (image.getUr
@@ -530,27 +530,26 @@
  return 
-nullIfEmpty
+trimToNull
 (image.g
@@ -662,147 +662,7 @@
    %7D
-%0A%0A    private String nullIfEmpty(final String s) %7B%0A        if(s.isEmpty())%0A            return null;%0A        else%0A            return s;%0A    %7D
 %0A%7D%0A

Remove nullIfEmpty method and use StringUtils instead