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
  edcd58e3_4044_db30_10f8_9fe252fb28ec["wrap()"]
  f1a34274_9212_49ef_a9b7_b1602eb3ab03["JSONObject()"]
  f1a34274_9212_49ef_a9b7_b1602eb3ab03 -->|calls| edcd58e3_4044_db30_10f8_9fe252fb28ec
  f1a34274_9212_49ef_a9b7_b1602eb3ab03["JSONObject()"]
  edcd58e3_4044_db30_10f8_9fe252fb28ec -->|calls| f1a34274_9212_49ef_a9b7_b1602eb3ab03
  33cce6ef_fe5a_f42c_a0a4_61748dd2d49e["toString()"]
  edcd58e3_4044_db30_10f8_9fe252fb28ec -->|calls| 33cce6ef_fe5a_f42c_a0a4_61748dd2d49e
  style edcd58e3_4044_db30_10f8_9fe252fb28ec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-metadata/src/json-shade/java/org/springframework/boot/configurationmetadata/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