public static ObjectType[] calculateTypesAlongPath(ExecutionContext context,
      ObjectType initialType, String[] pathArray) throws NameNotFoundException {
    ObjectType[] types = new ObjectType[pathArray.length + 1];
    // initialClass goes in front
    types[0] = initialType;

    for (int i = 1; i < types.length; i++) {
      ObjectType currentType = types[i - 1];
      Member member = new AttributeDescriptor(context.getCache().getPdxRegistry(), pathArray[i - 1])
          .getReadMember(currentType.resolveClass());

      if (member instanceof Field) {
        types[i] = TypeUtils.getObjectType(((Field) member).getType());
      } else if (member instanceof Method) {
        types[i] = TypeUtils.getObjectType(((Method) member).getReturnType());
      }
    }
    return types;
  }
@param pathArray the path starting with an attribute on the initial type.
@return array of types starting with the initialType and ending with the type of the last
        attribute in the path.
@throws NameNotFoundException if could not find an attribute along path
geode-core/src/main/java/org/apache/geode/cache/query/internal/PathUtils.java