Home / Function/ wrap() — spring-boot Function Reference

wrap() — spring-boot Function Reference

Architecture documentation for the wrap() function in JSONObject.java from the spring-boot codebase.

Function java GradlePlugin AotProcessing calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  dccf9bd1_038b_ccad_6dc0_c0412a7bc7da["wrap()"]
  135fcb76_5f4d_6bcf_4ec3_690e10d8d879["JSONObject()"]
  135fcb76_5f4d_6bcf_4ec3_690e10d8d879 -->|calls| dccf9bd1_038b_ccad_6dc0_c0412a7bc7da
  135fcb76_5f4d_6bcf_4ec3_690e10d8d879["JSONObject()"]
  dccf9bd1_038b_ccad_6dc0_c0412a7bc7da -->|calls| 135fcb76_5f4d_6bcf_4ec3_690e10d8d879
  25d40183_26ea_b694_9fd5_1317b25e7da2["toString()"]
  dccf9bd1_038b_ccad_6dc0_c0412a7bc7da -->|calls| 25d40183_26ea_b694_9fd5_1317b25e7da2
  style dccf9bd1_038b_ccad_6dc0_c0412a7bc7da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java lines 800–834

	@SuppressWarnings("rawtypes")
	public static Object wrap(Object o) {
		if (o == null) {
			return NULL;
		}
		if (o instanceof JSONArray || o instanceof JSONObject) {
			return o;
		}
		if (o.equals(NULL)) {
			return o;
		}
		try {
			if (o instanceof Collection) {
				return new JSONArray((Collection) o);
			}
			else if (o.getClass().isArray()) {
				return new JSONArray(o);
			}
			if (o instanceof Map) {
				return new JSONObject((Map) o);
			}
			if (o instanceof Boolean || o instanceof Byte || o instanceof Character || o instanceof Double
					|| o instanceof Float || o instanceof Integer || o instanceof Long || o instanceof Short
					|| o instanceof String) {
				return o;
			}
			if (o.getClass().getPackage().getName().startsWith("java.")) {
				return o.toString();
			}
		}
		catch (Exception ex) {
			// Ignore
		}
		return null;
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does wrap() do?
wrap() is a function in the spring-boot codebase.
What does wrap() call?
wrap() calls 2 function(s): JSONObject, toString.
What calls wrap()?
wrap() is called by 1 function(s): JSONObject.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free