code: @Override
  	public String getId() {
  		// As determining the name involves a fair bit of tree traversal, it is cached in the scratch map.
  		// Try to retrieve the cached name first.
  		Map scratchMap = getScratchMap();
  		if (scratchMap != null) {
  			String name = (String) scratchMap.get("name");
  			if (name != null) {
  				return name;
  			}
  		}
  
  		// Get ID name
  		String idName = getIdName();
  
  		String name;
  		// No ID name, so generate an ID
  		if (idName == null) {
  			name = generateId();
  		} else { // Has ID name, so derive the full context name
  			name = deriveId(idName);
  		}
  
  		if (scratchMap != null) {
  			scratchMap.put("name", name);
  		}
  
  		// Log warning if an Active Naming Context has no id name
  		if (this instanceof NamingContextable && ((NamingContextable) this).isNamingContext() && idName == null) {
  			LOG.warn(
  					"NamingContext [ID:" + name + "] does not have an id name set. Will be ignored.");
  		}
  
  		return name;
  	}
docs: {@inheritDoc}