import java.util.Map;
import java.util.UUID;
-import net.pterodactylus.util.object.Default;
-
import com.google.common.base.Function;
+import com.google.common.base.Optional;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
if (albumImage == null) {
return null;
}
- return Default.forNull(images.get(albumImage), images.values().iterator().next());
+ return Optional.fromNullable(images.get(albumImage)).or(images.values().iterator().next());
}
/**
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.util.number.Numbers;
-import net.pterodactylus.util.object.Default;
import net.pterodactylus.util.template.Filter;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.template.TemplateContextFactory;
import net.pterodactylus.util.template.TemplateParser;
+import com.google.common.base.Optional;
+
/**
* Template filter that turns an {@link Image} into an HTML <img> tag,
* using some parameters to influence parameters of the image.
linkTemplateContext.set("width", (int) (imageWidth * scale + 0.5));
linkTemplateContext.set("height", (int) (imageHeight * scale + 0.5));
}
- linkTemplateContext.set("alt", Default.forNull(title, image.getDescription()));
- linkTemplateContext.set("title", Default.forNull(title, image.getTitle()));
+ linkTemplateContext.set("alt", Optional.fromNullable(title).or(image.getDescription()));
+ linkTemplateContext.set("title", Optional.fromNullable(title).or(image.getTitle()));
StringWriter stringWriter = new StringWriter();
linkTemplate.render(linkTemplateContext, stringWriter);