From: David ‘Bombe’ Roden Date: Fri, 27 Jun 2014 16:30:58 +0000 (+0200) Subject: Add function to extract the context of a context object. X-Git-Tag: 0.9-rc1^2~3^2~222 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6ee1495f002df5e312c754df56d384d48b9261ee;p=Sone.git Add function to extract the context of a context object. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/Context.java b/src/main/java/net/pterodactylus/sone/freenet/wot/Context.java index 0f730fa..f72e56d 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/Context.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/Context.java @@ -17,6 +17,10 @@ package net.pterodactylus.sone.freenet.wot; +import javax.annotation.Nullable; + +import com.google.common.base.Function; + /** * Custom container for the Web of Trust context. This allows easier * configuration of dependency injection. @@ -25,6 +29,14 @@ package net.pterodactylus.sone.freenet.wot; */ public class Context { + public static final Function extractContext = new Function() { + @Nullable + @Override + public String apply(@Nullable Context context) { + return (context == null) ? null : context.getContext(); + } + }; + private final String context; public Context(String context) {