summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/data/Contexts.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/bjc/data/Contexts.java')
-rw-r--r--src/main/java/bjc/data/Contexts.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/bjc/data/Contexts.java b/src/main/java/bjc/data/Contexts.java
index 0769447..75c8480 100644
--- a/src/main/java/bjc/data/Contexts.java
+++ b/src/main/java/bjc/data/Contexts.java
@@ -2,17 +2,38 @@ package bjc.data;
import java.util.*;
+/**
+ * Utility methods for dealing with contexts.
+ *
+ * @author Ben Culkin
+ *
+ */
public class Contexts {
+ /**
+ * The null context, which always throws an exception.
+ */
public static final IContext NULL = new NullContextImpl();
private Contexts() {
throw new UnsupportedOperationException();
}
+ /**
+ * Create a new context with no parent.
+ *
+ * @return A context with no parent.
+ */
public static IContext create() {
return new ContextImpl(NULL);
}
+ /**
+ * Create a context with the specified parent.
+ *
+ * @param parent The parent of this context.
+ *
+ * @return A context with the given context as its parent.
+ */
public static IContext create(IContext parent) {
return new ContextImpl(parent);
}
@@ -47,7 +68,7 @@ public class Contexts {
public ContextImpl(IContext parent) {
this.parent = parent;
- this.objects = new HashMap<String, Object>();
+ this.objects = new HashMap<>();
}
@Override