Path getValidAttributePath(Object path, [ String basePath ])

Source

static Path getValidAttributePath(Object path, [String basePath]) {
  if (path is String) {
    Path p = new Path(path);
    if (p.valid && p.isAttribute) {
      return p..mergeBasePath(basePath);
    }
  }
  return null;
}