Merges the current resource with another resource instance.
The merge objects must represent the same resource but can
come from multiple methods.

@param resource the resource object to merge
13645
public void merge(Resource resource) {
        if (resource == null) {
            return;
        }

        checkRel(resource);
        checkHrefs(resource);

        if (resource.templated()) {
            this.pathParams.putAll(resource.pathParams);
            this.queryParams.putAll(resource.queryParams);
        }
        if (resource.hints() != null) {
            this.hints.merge(resource.hints());
        }
    }
1294557
static void cleanup(final Resource resource) {
        synchronized (resource) {
            for (final Resource.ResourceEntry entry : resource.getChildren(SUBSYSTEM)) {
                resource.removeChild(entry.getPathElement());
            }
            for (final Resource.ResourceEntry entry : resource.getChildren(SUBDEPLOYMENT)) {
                resource.removeChild(entry.getPathElement());
            }
        }
    }
436669
protected synchronized void merge(DoubleMinMax minmax) {
    this.minmax.put(minmax.getMin());
    this.minmax.put(minmax.getMax());
  }
1040901
public ResponseBuilder initialize(final Resource resource) {

        if (MISSING_RESOURCE.equals(resource)) {
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(resource)) {
            throw new ClientErrorException(GONE);
        }

        setResource(resource);
        return status(NO_CONTENT);
    }
53441
public void merge(MtasSolrCollectionResult newItem) throws IOException {
    if (action != null && newItem.action != null) {
      if (action.equals(ComponentCollection.ACTION_CREATE)
          && newItem.action.equals(ComponentCollection.ACTION_CREATE)) {
        values.addAll(newItem.values);
        if (id != null && (newItem.id == null || !newItem.id.equals(id))) {
          id = null;
        }
      } else if (action.equals(ComponentCollection.ACTION_LIST)) {
        if (list != null) {
          HashMap<String, SimpleOrderedMap<Object>> index = new HashMap<>();
          for (SimpleOrderedMap<Object> item : list) {
            if (item.get("id") != null && item.get("id") instanceof String) {
              index.put((String) item.get("id"), item);
              if (item.get("shards") == null
                  || !(item.get("shards") instanceof List)) {
                item.add("shards", new ArrayList<>());
              }
            }
          }
          for (SimpleOrderedMap<Object> item : newItem.list) {
            if (item.get("id") != null && item.get("id") instanceof String) {
              String id = (String) item.get("id");
              if (index.containsKey(id)) {
                SimpleOrderedMap<Object> indexItem = index.get(id);
                List<SimpleOrderedMap<Object>> shards;
                if (indexItem.get("shards") != null
                    && indexItem.get("shards") instanceof List) {
                  shards = (List<SimpleOrderedMap<Object>>) indexItem
                      .get("shards");
                } else {
                  shards = new ArrayList<>();
                  indexItem.add("shards", shards);
                }
                shards.add(item);
              }
            }
          }
        }
      } else if (action.equals(ComponentCollection.ACTION_CHECK)
          || action.equals(ComponentCollection.ACTION_POST)
          || action.equals(ComponentCollection.ACTION_IMPORT)
          || action.equals(ComponentCollection.ACTION_CREATE)
          || action.equals(ComponentCollection.ACTION_GET)) {
        if (status != null && status.get("id") != null
            && status.get("id") instanceof String) {
          String id = (String) status.get("id");
          if (id.equals(newItem.id)) {
            List<SimpleOrderedMap<Object>> shards;
            if (status.get("shards") != null
                && status.get("shards") instanceof List) {
              shards = (List<SimpleOrderedMap<Object>>) status.get("shards");
            } else {
              shards = new ArrayList<>();
              status.add("shards", shards);
            }
            if (newItem.status != null) {
              if (action.equals(ComponentCollection.ACTION_GET)) {
                newItem.status.add("values", newItem.values);
              }
              shards.add(newItem.status);
            }
          }
        }
      } else {
        throw new IOException("not allowed for action '" + action + "'");
      }
    }
  }
445643
def add(self, resource):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.add_if_changed(r)
        else:
            self.add_if_changed(resource)
467514
public void copyResource(String filename, String resource) throws IOException {
    write(filename, IOUtils.toByteArray(getClass().getResource(resource)));
  }
370528
public void addMethod(final String resource, final ResourceMethod method) {
        resources.putIfAbsent(resource, new HashSet<>());
        resources.get(resource).add(method);
    }
1230004
public void merge(ApplicationDefinition appDef, String shard) {
		MergeOptions options = new MergeOptions(null, 0, true);
		merge(appDef, shard, options);
	}
803937
public static ResourceHandle use(Resource resource) {
        return resource instanceof ResourceHandle
                ? ((ResourceHandle) resource) : new ResourceHandle(resource);
    }
52617
static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) {
        for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) {
            Object existing = original.get(entry.getKey());
            if (existing != null) {
                ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription);
            } else {
                original.put(entry.getKey(), entry.getValue());
            }
        }
    }
916893
static void createFileFromResource(String resource, Resource file) throws IOException {
	createFileFromResource(resource, file, null);
    }
294207
public static String readFromResource(String resource) throws IOException {

        InputStream in = getResourceAsStream(resource);
        if (in == null) {
            return null;
        }
        try {
            return read(in);
        } finally {
            closeQuietly(in);
        }
    }
399697
public void addCssResource(final ApplicationResource resource) {
		WApplicationModel model = getOrCreateComponentModel();
		if (model.cssResources == null) {
			model.cssResources = new ArrayList<>();
		} else if (model.cssResources.contains(resource)) {
			return;
		}
		model.cssResources.add(resource);
		MemoryUtil.checkSize(model.cssResources.size(), this.getClass().getSimpleName());
	}
1010200
function (objData, resource) {

    if(Utils.isObject(objData)){

      if(objData instanceof Resource){
        this.resource = objData;
      } else {
        this.resource = resource;
        Utils.extend(this, objData, true);
      }

    }
  }
995874
public void cache(Map<String, Object> resources) {
		verifyState();

		if (!cacheLocked.get()) {
			resourceCache.get().putAll(resources);
		}
	}
1277819
public UriMappingResolver addResource(String uri, String resource) {
        uriMap.put(uri, resource);
        return this;
    }