package org.scijava.object;

import java.util.WeakHashMap;

public class NamedObjectIndex<E> extends ObjectIndex<E> {
	
	private WeakHashMap<Object, String> nameMap;

	public NamedObjectIndex(final Class<E> baseClass) {
		super(baseClass);
		nameMap = new WeakHashMap<>();
	}

	public boolean add(E object, String name) {
		if (name != null)
			nameMap.put(object, name);
		return add(object);
	}

	public boolean add(E object, Class<?> type, String name, boolean batch) {
		if (name != null)
			nameMap.put(object, name);
		return add(object, type, batch);
	}

	public String getName(E object) {
		return nameMap.get(object);
	}
}

@@ -53,16 +53,124 @@
 shMap;%0A%0A
+/**%0A * An %7B@link ObjectIndex%7D where each object can have an associated name.%0A *%0A * @author Jan Eglinger%0A */%0A
 public c

add missing javadoc