seems like the logic for extraction of path is at multiple places, would it be better to move the extracting of descriptorPath to some utility class like S2PathUtil.getDescriptorPath(segment), same method can be used when creating the descriptor as well..