{"action":"created","comment":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/comments/44575072","id":44575072,"diff_hunk":"@@ -0,0 +1,133 @@\n+/*\n+ * Copyright (c) 2015-present, Parse, LLC.\n+ * All rights reserved.\n+ *\n+ * This source code is licensed under the BSD-style license found in the\n+ * LICENSE file in the root directory of this source tree. An additional grant\n+ * of patent rights can be found in the PATENTS file in the same directory.\n+ */\n+package com.parse;\n+\n+import java.lang.reflect.Constructor;\n+import java.lang.reflect.Modifier;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+/* package */ class ParseObjectSubclassingController {\n+  private static class ObjectSubclassInfo {\n+    public final Class<? extends ParseObject> type;\n+    public final String className;\n+    public final Constructor<? extends ParseObject> constructor;\n+\n+    public ObjectSubclassInfo(Class<? extends ParseObject> clazz) throws NoSuchMethodException {\n+      type = clazz;\n+      className = getClassName(type);\n+      constructor = getConstructor(clazz);\n+    }\n+\n+    private static Constructor<? extends ParseObject> getConstructor(Class<? extends  ParseObject> clazz) throws NoSuchMethodException {\n+      Constructor<? extends ParseObject> constructor = clazz.getDeclaredConstructor();\n+      int modifiers = constructor.getModifiers();\n+      if (Modifier.isPublic(modifiers) || (clazz.getPackage().getName().equals(\"com.parse\") &&\n+          !(Modifier.isProtected(modifiers) || Modifier.isPrivate(modifiers)))) {\n+        return constructor;\n+      }\n+      throw new NoSuchMethodException();\n+    }\n+\n+    private static String getClassName(Class<? extends ParseObject> clazz) {\n+      ParseClassName info = clazz.getAnnotation(ParseClassName.class);\n+      if (info == null) {\n+        return null;\n+      }\n+      return  info.value();\n+    }\n+  }\n+\n+  private Object mutex;\n+  private Map<String, ObjectSubclassInfo> registeredSubclasses;\n+\n+  public ParseObjectSubclassingController() {\n+    mutex = new Object();\n+    registeredSubclasses = new HashMap<>();\n+  }\n+\n+  String getClassName(Class<? extends ParseObject> clazz) {\n+    return ObjectSubclassInfo.getClassName(clazz);\n+  }\n+\n+  boolean isTypeValid(String className, Class<? extends ParseObject> clazz) {","path":"Parse/src/main/java/com/parse/ParseObjectSubclassingController.java","position":59,"original_position":59,"commit_id":"90ea274c680159a80ce2e1759e43c250a0cfb905","original_commit_id":"057e92ff8742a5260e83aa89e07830b400560dd7","user":{"login":"grantland","id":277030,"avatar_url":"https://avatars.githubusercontent.com/u/277030?v=3","gravatar_id":"","url":"https://api.github.com/users/grantland","html_url":"https://github.com/grantland","followers_url":"https://api.github.com/users/grantland/followers","following_url":"https://api.github.com/users/grantland/following{/other_user}","gists_url":"https://api.github.com/users/grantland/gists{/gist_id}","starred_url":"https://api.github.com/users/grantland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grantland/subscriptions","organizations_url":"https://api.github.com/users/grantland/orgs","repos_url":"https://api.github.com/users/grantland/repos","events_url":"https://api.github.com/users/grantland/events{/privacy}","received_events_url":"https://api.github.com/users/grantland/received_events","type":"User","site_admin":false},"body":"nit: `/* package */`","created_at":"2015-11-11T19:32:34Z","updated_at":"2015-11-11T19:32:34Z","html_url":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245#discussion_r44575072","pull_request_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245","_links":{"self":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/comments/44575072"},"html":{"href":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245#discussion_r44575072"},"pull_request":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245"}}},"pull_request":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245","id":50337688,"html_url":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245","diff_url":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245.diff","patch_url":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245.patch","issue_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/245","number":245,"state":"open","locked":false,"title":"Decouple object subclassing.","user":{"login":"richardjrossiii","id":699752,"avatar_url":"https://avatars.githubusercontent.com/u/699752?v=3","gravatar_id":"","url":"https://api.github.com/users/richardjrossiii","html_url":"https://github.com/richardjrossiii","followers_url":"https://api.github.com/users/richardjrossiii/followers","following_url":"https://api.github.com/users/richardjrossiii/following{/other_user}","gists_url":"https://api.github.com/users/richardjrossiii/gists{/gist_id}","starred_url":"https://api.github.com/users/richardjrossiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardjrossiii/subscriptions","organizations_url":"https://api.github.com/users/richardjrossiii/orgs","repos_url":"https://api.github.com/users/richardjrossiii/repos","events_url":"https://api.github.com/users/richardjrossiii/events{/privacy}","received_events_url":"https://api.github.com/users/richardjrossiii/received_events","type":"User","site_admin":false},"body":"This fully decouples object subclassing from the ParseObject class, bringing it up to parity with our other native platforms.","created_at":"2015-11-11T01:37:17Z","updated_at":"2015-11-11T19:32:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62c820ed3b88a2d305000bef222793e60208b8c0","assignee":{"login":"grantland","id":277030,"avatar_url":"https://avatars.githubusercontent.com/u/277030?v=3","gravatar_id":"","url":"https://api.github.com/users/grantland","html_url":"https://github.com/grantland","followers_url":"https://api.github.com/users/grantland/followers","following_url":"https://api.github.com/users/grantland/following{/other_user}","gists_url":"https://api.github.com/users/grantland/gists{/gist_id}","starred_url":"https://api.github.com/users/grantland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grantland/subscriptions","organizations_url":"https://api.github.com/users/grantland/orgs","repos_url":"https://api.github.com/users/grantland/repos","events_url":"https://api.github.com/users/grantland/events{/privacy}","received_events_url":"https://api.github.com/users/grantland/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245/commits","review_comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245/comments","review_comment_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/245/comments","statuses_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/statuses/90ea274c680159a80ce2e1759e43c250a0cfb905","head":{"label":"ParsePlatform:richardross.subclassing.decouple","ref":"richardross.subclassing.decouple","sha":"90ea274c680159a80ce2e1759e43c250a0cfb905","user":{"login":"ParsePlatform","id":1294580,"avatar_url":"https://avatars.githubusercontent.com/u/1294580?v=3","gravatar_id":"","url":"https://api.github.com/users/ParsePlatform","html_url":"https://github.com/ParsePlatform","followers_url":"https://api.github.com/users/ParsePlatform/followers","following_url":"https://api.github.com/users/ParsePlatform/following{/other_user}","gists_url":"https://api.github.com/users/ParsePlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/ParsePlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParsePlatform/subscriptions","organizations_url":"https://api.github.com/users/ParsePlatform/orgs","repos_url":"https://api.github.com/users/ParsePlatform/repos","events_url":"https://api.github.com/users/ParsePlatform/events{/privacy}","received_events_url":"https://api.github.com/users/ParsePlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":40628209,"name":"Parse-SDK-Android","full_name":"ParsePlatform/Parse-SDK-Android","owner":{"login":"ParsePlatform","id":1294580,"avatar_url":"https://avatars.githubusercontent.com/u/1294580?v=3","gravatar_id":"","url":"https://api.github.com/users/ParsePlatform","html_url":"https://github.com/ParsePlatform","followers_url":"https://api.github.com/users/ParsePlatform/followers","following_url":"https://api.github.com/users/ParsePlatform/following{/other_user}","gists_url":"https://api.github.com/users/ParsePlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/ParsePlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParsePlatform/subscriptions","organizations_url":"https://api.github.com/users/ParsePlatform/orgs","repos_url":"https://api.github.com/users/ParsePlatform/repos","events_url":"https://api.github.com/users/ParsePlatform/events{/privacy}","received_events_url":"https://api.github.com/users/ParsePlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ParsePlatform/Parse-SDK-Android","description":"Parse SDK for Android","fork":false,"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android","forks_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/forks","keys_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/teams","hooks_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/hooks","issue_events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/events{/number}","events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/events","assignees_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/assignees{/user}","branches_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/branches{/branch}","tags_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/tags","blobs_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/languages","stargazers_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/stargazers","contributors_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/contributors","subscribers_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/subscribers","subscription_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/subscription","commits_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/contents/{+path}","compare_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/merges","archive_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/downloads","issues_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues{/number}","pulls_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/labels{/name}","releases_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/releases{/id}","created_at":"2015-08-12T22:57:48Z","updated_at":"2015-11-11T03:19:04Z","pushed_at":"2015-11-11T05:21:55Z","git_url":"git://github.com/ParsePlatform/Parse-SDK-Android.git","ssh_url":"git@github.com:ParsePlatform/Parse-SDK-Android.git","clone_url":"https://github.com/ParsePlatform/Parse-SDK-Android.git","svn_url":"https://github.com/ParsePlatform/Parse-SDK-Android","homepage":"https://parse.com","size":1588,"stargazers_count":842,"watchers_count":842,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":43,"forks":131,"open_issues":43,"watchers":842,"default_branch":"master"}},"base":{"label":"ParsePlatform:master","ref":"master","sha":"279f7a14c5324e8b99c31cd2215163b1fe5dc8fa","user":{"login":"ParsePlatform","id":1294580,"avatar_url":"https://avatars.githubusercontent.com/u/1294580?v=3","gravatar_id":"","url":"https://api.github.com/users/ParsePlatform","html_url":"https://github.com/ParsePlatform","followers_url":"https://api.github.com/users/ParsePlatform/followers","following_url":"https://api.github.com/users/ParsePlatform/following{/other_user}","gists_url":"https://api.github.com/users/ParsePlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/ParsePlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParsePlatform/subscriptions","organizations_url":"https://api.github.com/users/ParsePlatform/orgs","repos_url":"https://api.github.com/users/ParsePlatform/repos","events_url":"https://api.github.com/users/ParsePlatform/events{/privacy}","received_events_url":"https://api.github.com/users/ParsePlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":40628209,"name":"Parse-SDK-Android","full_name":"ParsePlatform/Parse-SDK-Android","owner":{"login":"ParsePlatform","id":1294580,"avatar_url":"https://avatars.githubusercontent.com/u/1294580?v=3","gravatar_id":"","url":"https://api.github.com/users/ParsePlatform","html_url":"https://github.com/ParsePlatform","followers_url":"https://api.github.com/users/ParsePlatform/followers","following_url":"https://api.github.com/users/ParsePlatform/following{/other_user}","gists_url":"https://api.github.com/users/ParsePlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/ParsePlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParsePlatform/subscriptions","organizations_url":"https://api.github.com/users/ParsePlatform/orgs","repos_url":"https://api.github.com/users/ParsePlatform/repos","events_url":"https://api.github.com/users/ParsePlatform/events{/privacy}","received_events_url":"https://api.github.com/users/ParsePlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ParsePlatform/Parse-SDK-Android","description":"Parse SDK for Android","fork":false,"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android","forks_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/forks","keys_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/teams","hooks_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/hooks","issue_events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/events{/number}","events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/events","assignees_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/assignees{/user}","branches_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/branches{/branch}","tags_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/tags","blobs_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/languages","stargazers_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/stargazers","contributors_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/contributors","subscribers_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/subscribers","subscription_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/subscription","commits_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/contents/{+path}","compare_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/merges","archive_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/downloads","issues_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues{/number}","pulls_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/labels{/name}","releases_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/releases{/id}","created_at":"2015-08-12T22:57:48Z","updated_at":"2015-11-11T03:19:04Z","pushed_at":"2015-11-11T05:21:55Z","git_url":"git://github.com/ParsePlatform/Parse-SDK-Android.git","ssh_url":"git@github.com:ParsePlatform/Parse-SDK-Android.git","clone_url":"https://github.com/ParsePlatform/Parse-SDK-Android.git","svn_url":"https://github.com/ParsePlatform/Parse-SDK-Android","homepage":"https://parse.com","size":1588,"stargazers_count":842,"watchers_count":842,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":43,"forks":131,"open_issues":43,"watchers":842,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245"},"html":{"href":"https://github.com/ParsePlatform/Parse-SDK-Android/pull/245"},"issue":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/245"},"comments":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/issues/245/comments"},"review_comments":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245/comments"},"review_comment":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/pulls/245/commits"},"statuses":{"href":"https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/statuses/90ea274c680159a80ce2e1759e43c250a0cfb905"}}}}