private Map<String, Object> mergeBindings( final Context context, final Bindings request, final Bindings... scopes) { Set<String> safeAttributes = null != request ? request.keySet() : Collections.EMPTY_SET; Map<String, Object> scope = new HashMap<String, Object>(); for (Map<String, Object> next : scopes) { if (null == next) { continue; } for (Map.Entry<String, Object> entry : next.entrySet()) { if (scope.containsKey(entry.getKey()) || safeAttributes.contains(entry.getKey())) { continue; } scope.put(entry.getKey(), entry.getValue()); } } // Make lazy deep copy if (!scope.isEmpty()) { scope = new LazyMap<String, Object>( new InnerMapFactory( scope, new OperationParameter(context, "DEFAULT", engine.getPersistenceConfig()))); } if (null == request || request.isEmpty()) { return scope; } else if (scope.isEmpty()) { return request; } else { request.putAll(scope); return request; } }