@SuppressWarnings("unchecked") public void loadCollection(Collection collection, ObjectCache objectsBeingAccessed) { try { // First thing first, get collection size, which is stored during update CollectionSizeProperty sizeProperty = new CollectionSizeProperty(property); Integer collectionSize = (Integer) Loader.loadSingleLiteral(classLoader, sizeProperty, rootVertex, objectsBeingAccessed); // using a treemap to allow filling in any order AND unnumbered items to be at the end Map<Integer, ValueLoader> loaders = new TreeMap<Integer, CollectionLazyLoader.ValueLoader>(); loaders.putAll(addEdgesLoaders()); loaders.putAll(addPropertyValueLoaders()); for (ValueLoader loader : loaders.values()) { try { collection.add(loader.load(objectsBeingAccessed)); } catch (UnableToCreateException ex) { if (logger.isLoggable(Level.WARNING)) { logger.log( Level.WARNING, "we failed to load value associated with loader " + loader.toString(), ex); } } } } finally { loaded = true; } }
@Override public Object load(ObjectCache objectsBeingAccessed) { return Loader.loadSingleLiteral(classLoader, toLoad, rootVertex, objectsBeingAccessed); }