InternalGradleProject (final IonReader reader, final ReadContext context, final String fieldName) { IonType ionType = reader.next(); if (fieldName != null) { assertFieldName(reader, fieldName); } if (ionType == IonType.NULL || ionType == null) { return null; } reader.stepIn(); InternalGradleProject project = context.gradleProjectsMap.computeIfAbsent(readInt(reader, OBJECT_ID_FIELD), new IntObjectMap.ObjectFactory<InternalGradleProject>() { @Override public InternalGradleProject newInstance() { return new InternalGradleProject(); } @Override public void fill(InternalGradleProject gradleProject) { gradleProject.setName(readString(reader, "name")); gradleProject.setDescription(readString(reader, "description")); gradleProject.setProjectDirectory(readFile(reader, "projectDirectory")); gradleProject.setProjectIdentifier(readProjectIdentifier(reader, context)); gradleProject.setBuildDirectory(readFile(reader, "buildDirectory")); gradleProject.setParent(readGradleProject(reader, context, "parent")); reader.next(); assertFieldName(reader, "children"); reader.stepIn(); List<InternalGradleProject> children = new ArrayList<>(); InternalGradleProject child; while ((child = readGradleProject(reader, context, null)) != null) { children.add(child); } gradleProject.setChildren(children); reader.stepOut(); gradleProject.getBuildScript().setSourceFile(readFile(reader, "buildScript")); reader.next(); assertFieldName(reader, "tasks"); reader.stepIn(); List<InternalGradleTask> tasks = new ArrayList<>(); InternalGradleTask task; while ((task = readGradleTask(reader, context)) != null) { tasks.add(task); } gradleProject.setTasks(tasks); reader.stepOut(); } }); reader.stepOut(); return project; }