All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bitbucket.gkutiel.at.Context Maven / Gradle / Ivy

package org.bitbucket.gkutiel.at;

import java.util.Iterator;

public abstract class Context implements Iterable {
	final Context parent;

	public Context(final Context parent) {
		this.parent = parent;
	}

	public void add(final Context ctx) {
		if (parent == null) throw new RuntimeException("can't add");
		parent.add(ctx);
	}

	public Context get(final String name) {
		if (parent == null) return null;
		return parent.get(name);
	}

	@Override public Iterator iterator() {
		throw new RuntimeException("can't iterate over me");
	}

	public void set(final String name, final Context ctx) {
		if (parent == null) throw new RuntimeException("can't set");
		parent.set(name, ctx);
	}

	@SuppressWarnings("static-method") public String val() {
		throw new RuntimeException("not a valid operation");
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy