Home / Class/ AbstractJsonParser Class — spring-boot Architecture

AbstractJsonParser Class — spring-boot Architecture

Architecture documentation for the AbstractJsonParser class in AbstractJsonParser.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/main/java/org/springframework/boot/json/AbstractJsonParser.java lines 35–66

public abstract class AbstractJsonParser implements JsonParser {

	protected final Map<String, Object> parseMap(@Nullable String json, Function<String, Map<String, Object>> parser) {
		return trimParse(json, "{", parser);
	}

	protected final List<Object> parseList(@Nullable String json, Function<String, List<Object>> parser) {
		return trimParse(json, "[", parser);
	}

	protected final <T> T trimParse(@Nullable String json, String prefix, Function<String, T> parser) {
		String trimmed = (json != null) ? json.trim() : "";
		if (trimmed.startsWith(prefix)) {
			return parser.apply(trimmed);
		}
		throw new JsonParseException();
	}

	protected final <T> T tryParse(Callable<T> parser, Class<? extends Exception> check) {
		try {
			return parser.call();
		}
		catch (Exception ex) {
			if (check.isAssignableFrom(ex.getClass())) {
				throw new JsonParseException(ex);
			}
			ReflectionUtils.rethrowRuntimeException(ex);
			throw new IllegalStateException(ex);
		}
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free