private <T> Map<ID, T> createInstances(MappedClass mappedClass, Class<T> clazz, boolean polymorphic, UID context, Map<ID, Multimap<UID, STMT>> directProps, Map<ID, Multimap<UID, STMT>> inverseProps) { Map<ID, T> idToInstance = new HashMap<ID, T>(directProps.size()); for (Map.Entry<ID, Multimap<UID, STMT>> entry : directProps.entrySet()) { T instance = getCached(entry.getKey(), clazz); if (instance == null) { PropertiesMap properties = new PropertiesMap(entry.getValue(), inverseProps.get(entry.getKey())); instance = getMappedObject(mappedClass, entry.getKey(), clazz, properties, polymorphic, context, false); if (instance != null) { idToInstance.put(entry.getKey(), instance); } } } return idToInstance; }
T instance = getCached(entry.getKey(), clazz); if (idToInstance.containsKey(entry.getKey())) { PropertiesMap properties = new PropertiesMap(entry.getValue(), inverseProps.get(entry.getKey())); MappedClass mc = resolveMappedClass(mappedClass, properties); bind(mc, entry.getKey(), instance, properties);
T instance = getCached(entry.getKey(), clazz); if (idToInstance.containsKey(entry.getKey())) { PropertiesMap properties = new PropertiesMap(entry.getValue(), inverseProps.get(entry.getKey())); MappedClass mc = resolveMappedClass(mappedClass, properties); bind(mc, entry.getKey(), instance, properties);
instance = getCached(subject, clazz); if (idToInstance.containsKey(subject)) { PropertiesMap properties = new PropertiesMap(directProps.get(subject), inverseProps.get(subject)); bind(mappedClass, subject, instance, properties);
@Override public void autowire(Object instance) { Assert.notNull(instance, "instance"); BeanMap beanMap = toBeanMap(instance); MappedClass mappedClass = configuration.getMappedClass(getClass(instance)); bind(mappedClass, getId(mappedClass, beanMap), beanMap, new PropertiesMap()); }
inverse = getInvProperties(subject, mappedClass); instance = getMappedObject(mappedClass, subject, requiredClass, new PropertiesMap(direct, inverse), polymorphic, context, true);
private Set<NODE> findPathValues(ID resource, MappedPath path, int index, PropertiesMap properties, UID context) { MappedPredicate predicate = path.get(index); if (predicate.getContext() != null) { context = predicate.getContext(); } Set<NODE> values; if (!predicate.inv() && properties.getDirect() != null) { values = findValues(predicate.getUID(), properties.getDirect(), context, predicate.inv()); } else if (predicate.inv() && properties.getInverse() != null) { values = findValues(predicate.getUID(), properties.getInverse(), null, predicate.inv()); } else { values = findValues(resource, predicate.getUID(), predicate.inv(), predicate.includeInferred(), context); } if (path.size() > index + 1) { Set<NODE> nestedValues = new LinkedHashSet<NODE>(); for (NODE value : values) { if (value.isResource()) { nestedValues.addAll(findPathValues((ID) value, path, index + 1, new PropertiesMap(null, null), context)); } } return nestedValues; } return values; }