JsonSchemaObject (@NotNull JsonValueAdapter rootAdapter) { final JsonSchemaObject root = new JsonSchemaObject(myFile, "/"); enqueue(myQueue, root, rootAdapter); while (!myQueue.isEmpty()) { final Pair<JsonSchemaObject, JsonValueAdapter> currentItem = myQueue.removeFirst(); JsonSchemaObject currentSchema = currentItem.first; String pointer = currentSchema.getPointer(); JsonValueAdapter adapter = currentItem.second; if (adapter instanceof JsonObjectValueAdapter) { final List<JsonPropertyAdapter> list = ((JsonObjectValueAdapter)adapter).getPropertyList(); for (JsonPropertyAdapter property : list) { Collection<JsonValueAdapter> values = property.getValues(); if (values.size() != 1) continue; String name = property.getName(); if (name == null) continue; final MyReader reader = READERS_MAP.get(name); JsonValueAdapter value = values.iterator().next(); if (reader != null) { reader.read(value, currentSchema, myQueue, myFile); } else { readSingleDefinition(name, value, currentSchema, pointer); } } } else if (adapter instanceof JsonArrayValueAdapter) { List<JsonValueAdapter> values = ((JsonArrayValueAdapter)adapter).getElements(); for (int i = 0; i < values.size(); i++) { readSingleDefinition(String.valueOf(i), values.get(i), currentSchema, pointer); } } if (currentSchema.getId() != null) myIds.put(currentSchema.getId(), currentSchema); currentSchema.completeInitialization(adapter); } return root; }