Copies {@code src} into a new {@link JSONObject}.

@param src  {@code JSONObject} to copy
@param deep {@code True} to perform a deep copy, {@code false} to perform
a shallow copy
@return A new {@code JSONObject} copied from {@code src}
558789
public static JSONObject copy(final JSONObject src, final boolean deep) {
        final JSONObject dest = new JSONObject();
        Iterator<String> keys = src.keys();
        while (keys.hasNext()) {
            final String key = keys.next();
            final Object value = src.opt(key);
            if (deep) {
                if (value instanceof JSONObject) {
                    safePut(dest, key, copy((JSONObject) value, deep));
                } else if (value instanceof JSONArray) {
                    safePut(dest, key, copy((JSONArray) value, deep));
                } else {
                    safePut(dest, key, value);
                }
            } else {
                safePut(dest, key, value);
            }
        }
        return dest;
    }
118114
public void copy(Object src, Object target) throws BeanMappingException {
        BeanMappingParam param = new BeanMappingParam();
        param.setSrcRef(src);
        param.setTargetRef(target);
        param.setConfig(this.config);
        param.setProcesses(BeanMappingEnvironment.getBeanCopyVps());

        // 执行mapping处理
        BeanMappingExecutor.execute(param);
    }
703174
public LinkedMultiValueMap<K, V> deepCopy() {
        LinkedMultiValueMap<K, V> copy = new LinkedMultiValueMap<>(this.size());
        this.forEach((key, value) -> copy.put(key, new LinkedList<>(value)));
        return copy;
    }
507054
def copy(self, deep=False):
        
        cause = self._cause
        if cause is not None:
            cause = cause.copy(deep=deep)
        exc_info = utils.copy_exc_info(self.exc_info, deep=deep)
        exc_args = self.exception_args
        exc_kwargs = self.exception_kwargs
        if deep:
            exc_args = copy.deepcopy(exc_args)
            exc_kwargs = copy.deepcopy(exc_kwargs)
        else:
            exc_args = tuple(exc_args)
            exc_kwargs = exc_kwargs.copy()
        # These are just simple int/strings, so deep copy doesn't really
        # matter/apply here (as they are immutable anyway).
        exc_type_names = tuple(self._exc_type_names)
        generated_on = self._generated_on
        if generated_on:
            generated_on = tuple(generated_on)
        # NOTE(harlowja): use `self.__class__` here so that we can work
        # with subclasses (assuming anyone makes one).
        return self.__class__(exc_info=exc_info,
                              exception_str=self.exception_str,
                              traceback_str=self.traceback_str,
                              exc_args=exc_args,
                              exc_kwargs=exc_kwargs,
                              exc_type_names=exc_type_names,
                              cause=cause, generated_on=generated_on)
583500
public static Object deepBox(Object src) {
        Class<?> resultType = arrayBoxingType(src.getClass());
        return deepBox(resultType, src);
    }
84306
function Copy(src, withAccess) {
  if (!(this instanceof Copy)) return new Copy(src, withAccess);
  this.src = src;
  this._withAccess = withAccess;
}
475700
public static final char[][] deepCopy(char[][] toCopy)
	{
		int toCopyLength = toCopy.length;
		char[][] result = new char[toCopyLength][];
		for (int i = 0; i < toCopyLength; i++)
		{
			char[] toElement = toCopy[i];
			int toElementLength = toElement.length;
			char[] resultElement = new char[toElementLength];
			System.arraycopy(toElement, 0, resultElement, 0, toElementLength);
			result[i] = resultElement;
		}
		return result;
	}
1261833
private void copyInternal(
      BatchHelper batchHelper,
      final KeySetView<IOException, Boolean> innerExceptions,
      final String srcBucketName, final String srcObjectName,
      final String dstBucketName, final String dstObjectName)
      throws IOException {
    Storage.Objects.Copy copyObject =
        configureRequest(
            gcs.objects().copy(srcBucketName, srcObjectName, dstBucketName, dstObjectName, null),
            srcBucketName);

    batchHelper.queue(
        copyObject,
        new JsonBatchCallback<StorageObject>() {
          @Override
          public void onSuccess(StorageObject copyResponse, HttpHeaders responseHeaders) {
            String srcString = StorageResourceId.createReadableString(srcBucketName, srcObjectName);
            String dstString = StorageResourceId.createReadableString(dstBucketName, dstObjectName);
            logger.atFine().log("Successfully copied %s to %s", srcString, dstString);
          }

          @Override
          public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
            onCopyFailure(innerExceptions, e, srcBucketName, srcObjectName);
          }
        });
  }
375785
public FunctionLib duplicate(boolean deepCopy) {
	FunctionLib fl = new FunctionLib();

	fl.description = this.description;
	fl.displayName = this.displayName;
	fl.functions = duplicate(this.functions, deepCopy);
	fl.shortName = this.shortName;
	fl.uri = this.uri;
	fl.version = this.version;

	return fl;
    }
1053235
def copy(self, deep=False, name=None):
        
        if deep:
            other = deepcopy(self)
        else:
            other = copy(self)

        if hasattr(self, 'name'):
            other.name = get_default(name, self.name + '_copy')

        return other
1035149
public Object shallowCopy() {
        Object copy = null;
        try {
            copy = super.clone();
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
        return copy;
    }
308631
@Override
    public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
        if (src == null) {
            return JsonNull.INSTANCE;
        } else {
            return new JsonPrimitive(apiClient.formatDatetime(src));
        }
    }
547176
@SuppressWarnings("unchecked")
    public static Map deepMerge(Map dst, Map src) {
        if (dst != null && src != null) {
            for (Object key : src.keySet()) {
                if (src.get(key) instanceof Map && dst.get(key) instanceof Map) {
                    Map originalChild = (Map)dst.get(key);
                    Map newChild = (Map)src.get(key);
                    dst.put(key, deepMerge(originalChild, newChild));
                } else {
                    dst.put(key, src.get(key));
                }
            }
        }

        return dst;
    }
237174
public static void shallowCopyFieldState(final Object src, final Object dest) {
		if (src == null) {
			throw new IllegalArgumentException("Source for field copy cannot be null");
		}
		if (dest == null) {
			throw new IllegalArgumentException("Destination for field copy cannot be null");
		}
		if (!src.getClass().isAssignableFrom(dest.getClass())) {
			throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
					"] must be same or subclass as source class [" + src.getClass().getName() + "]");
		}
		doWithFields(src.getClass(), new FieldCallback() {
			@Override
			public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
				makeAccessible(field);
				Object srcValue = field.get(src);
				field.set(dest, srcValue);
			}
		}, COPYABLE_FIELDS);
	}
2867
public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {
        ChannelSftp sftp;

        try {
            sftp = alloc();
            try {
                sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);
            } finally {
                free(sftp);
            }
        } catch (SftpException | JSchException e) {
            throw new CopyFileFromException(this, e);
        }
    }
1239025
public static JSONArray copy(final JSONArray src) {
        final JSONArray dest = new JSONArray();
        final int len = src.length();
        for (int i = 0; i < len; ++i) {
            dest.put(src.opt(i));
        }
        return dest;
    }
492998
public JSONObject instantiateJsonObject(InputStream in) throws IOException,
                                                                JSONException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    StringBuffer contents = new StringBuffer();
    String text = null;
    while ((text = reader.readLine()) != null) {
      contents.append(text).append(System.getProperty("line.separator"));
    }
    in.close();
    JSONObject json = new JSONObject(contents.toString());
    return json;
  }