Source:
public Object processFetch(Environment context, PersistentResourceFetcher fetcher) { EntityDictionary entityDictionary = context.requestScope.getDictionary(); NonEntityDictionary nonEntityDictionary = fetcher.getNonEntityDictionary(); Type parentClass = context.parentResource.getResourceType(); String fieldName = context.field.getName(); String idFieldName = entityDictionary.getIdFieldName(parentClass); if (entityDictionary.isAttribute(parentClass, fieldName)) { Attribute requested = context.requestScope.getProjectionInfo() .getAttributeMap().getOrDefault(context.field.getSourceLocation(), null); Object attribute = context.parentResource.getAttribute(requested); if (attribute != null && nonEntityDictionary.hasBinding(new ClassType(attribute.getClass()))) { return new NonEntityContainer(attribute); } if (attribute instanceof Map) { return ((Map<Object, Object>) attribute).entrySet().stream() .map(MapEntryContainer::new) .collect(Collectors.toList()); } if (attribute instanceof Collection) { Type<?> innerType = entityDictionary.getParameterizedType(parentClass, fieldName); if (nonEntityDictionary.hasBinding(innerType)) { return ((Collection) attribute).stream() .map(NonEntityContainer::new) .collect(Collectors.toList()); } } return attribute; } if (entityDictionary.isRelation(parentClass, fieldName)) { Relationship relationship = context.requestScope .getProjectionInfo() .getRelationshipMap() .getOrDefault(context.field.getSourceLocation(), null); if (relationship == null) { throw new BadRequestException( "Relationship doesn't have projection " + context.parentResource.getTypeName() + "." + fieldName); } return fetcher.fetchRelationship(context.parentResource, relationship, context.ids); } if (Objects.equals(idFieldName, fieldName)) { return new DeferredId(context.parentResource); } throw new BadRequestException("Unrecognized object: " + fieldName + " for: " + parentClass.getName() + " in node"); }

Target:
public Object processFetch(Environment context, PersistentResourceFetcher fetcher) { EntityDictionary entityDictionary = context.requestScope.getDictionary(); NonEntityDictionary nonEntityDictionary = fetcher.getNonEntityDictionary(); Type parentClass = context.parentResource.getResourceType(); String fieldName = context.field.getName(); String idFieldName = entityDictionary.getIdFieldName(parentClass); if (entityDictionary.isAttribute(parentClass, fieldName)) { Attribute requested = context.requestScope.getProjectionInfo() .getAttributeMap().getOrDefault(context.field.getSourceLocation(), null); Object attribute = context.parentResource.getAttribute(requested); if (attribute != null && nonEntityDictionary.hasBinding(EntityDictionary.getType(attribute))) { return new NonEntityContainer(attribute); } if (attribute instanceof Map) { return ((Map<Object, Object>) attribute).entrySet().stream() .map(MapEntryContainer::new) .collect(Collectors.toList()); } if (attribute instanceof Collection) { Type<?> innerType = entityDictionary.getParameterizedType(parentClass, fieldName); if (nonEntityDictionary.hasBinding(innerType)) { return ((Collection) attribute).stream() .map(NonEntityContainer::new) .collect(Collectors.toList()); } } return attribute; } if (entityDictionary.isRelation(parentClass, fieldName)) { Relationship relationship = context.requestScope .getProjectionInfo() .getRelationshipMap() .getOrDefault(context.field.getSourceLocation(), null); if (relationship == null) { throw new BadRequestException("Relationship doesn't have projection " + context.parentResource.getTypeName() + "." + fieldName); } return fetcher.fetchRelationship(context.parentResource, relationship, context.ids); } if (Objects.equals(idFieldName, fieldName)) { return new DeferredId(context.parentResource); } throw new BadRequestException("Unrecognized object: " + fieldName + " for: " + parentClass.getName() + " in node"); }