src/main/java/com/googlecode/objectify/impl/translate/LoadContext.java
public Object getContainer(Type containerType, Path path) {
		Class<?> containerClass = GenericTypeReflector.erase(containerType);
		
		Iterator<Object> containersIt = containers.descendingIterator();

		// We have always entered the current 'this' context when processing properties, so the first thing
		// we get will always be 'this'. So skip that and the first matching owner should be what we want.
		containersIt.next();

		while (containersIt.hasNext()) {
			Object potentialContainer = containersIt.next();
			
			if (containerClass.isAssignableFrom(potentialContainer.getClass()))
				return potentialContainer;
		}
		
		throw new IllegalStateException("No container matching " + containerType + " in " + containers + " at path " + path);
	}
public Object getContainer(Type containerType, Path path) {
		Class<?> containerClass = GenericTypeReflector.erase(containerType);
		
		Iterator<Object> containersIt = containers.descendingIterator();

		// We have always entered the current 'this' context when processing properties, so the first thing
		// we get will always be 'this'. So skip that and the first matching owner should be what we want.
		containersIt.next();

		while (containersIt.hasNext()) {
			Object potentialContainer = containersIt.next();
			
			if (containerClass.isAssignableFrom(potentialContainer.getClass()))
				return potentialContainer;
		}
		
		throw new IllegalStateException("No container matching " + containerType + " in " + containers + " at path " + path);
	}
public Object getContainer ( Type containerType , Path path ) { Class < ? > containerClass = GenericTypeReflector . erase ( containerType ) ; Iterator < Object > containersIt = containers . descendingIterator ( ) ; // We have always entered the current 'this' context when processing properties, so the first thing // we get will always be 'this'. So skip that and the first matching owner should be what we want. containersIt . next ( ) ; while ( containersIt . hasNext ( ) ) { Object potentialContainer = containersIt . next ( ) ; if ( containerClass . isAssignableFrom ( potentialContainer . getClass ( ) ) ) return potentialContainer ; } throw new IllegalStateException ( "No container matching " + containerType + " in " + containers + " at path " + path ) ; }
Get the container object which is appropriate for the specified property. Go up the chain looking for a compatible
type; the first one found is the container. If nothing found, throw an exception.
Get the container object which is appropriate for the specified property . Go up the chain looking for a compatible type ; the first one found is the container . If nothing found throw an exception .