{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/761","repository_url":"https://api.github.com/repos/realm/realm-java","labels_url":"https://api.github.com/repos/realm/realm-java/issues/761/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/761/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/761/events","html_url":"https://github.com/realm/realm-java/issues/761","id":54733746,"number":761,"title":"Inheritance / Polymorphism","user":{"login":"cmelchior","id":406066,"avatar_url":"https://avatars.githubusercontent.com/u/406066?v=3","gravatar_id":"","url":"https://api.github.com/users/cmelchior","html_url":"https://github.com/cmelchior","followers_url":"https://api.github.com/users/cmelchior/followers","following_url":"https://api.github.com/users/cmelchior/following{/other_user}","gists_url":"https://api.github.com/users/cmelchior/gists{/gist_id}","starred_url":"https://api.github.com/users/cmelchior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmelchior/subscriptions","organizations_url":"https://api.github.com/users/cmelchior/orgs","repos_url":"https://api.github.com/users/cmelchior/repos","events_url":"https://api.github.com/users/cmelchior/events{/privacy}","received_events_url":"https://api.github.com/users/cmelchior/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/Blocked%20On%20Core","name":"Blocked On Core","color":"fad8c7"},{"url":"https://api.github.com/repos/realm/realm-java/labels/S:P2%20Backlog","name":"S:P2 Backlog","color":"dedede"},{"url":"https://api.github.com/repos/realm/realm-java/labels/T:Feature","name":"T:Feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":36,"created_at":"2015-01-19T07:26:24Z","updated_at":"2016-03-31T06:19:25Z","closed_at":null,"body":"A highly request feature is polymorphism. Mostly for use in ListAdapters, but a lot of other scenarios exists.\r\n\r\nWe need support for the following:\r\n- Abstract RealmObject classes\r\n- Query support\r\n\r\nExample\r\n```\r\npublic abstract Animal extends RealmObject {\r\n  private String name;\r\n}\r\n\r\npublic class Dog extends Animal {\r\n  private boolean willPlayCatch;\r\n}\r\n\r\npublic class Spider extends Animal {\r\n  private boolean isScary;\r\n}\r\n\r\n// Following should be possible\r\nRealmResults<Animal> animals = realm.where(Animal.class).equalsTo(\"name\",\"Foo\").findAll();\r\nString name = animals.get(0).getName();\r\n\r\nRealmResults<Dog> dogs = realm.where(Dog.class).equalsTo(\"name\",\"Foo\").and().equalsTo(\"willPlayCatch\", true).findAll();\r\nString name = dogs.get(0).getName();\r\n```\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/203774619","html_url":"https://github.com/realm/realm-java/issues/761#issuecomment-203774619","issue_url":"https://api.github.com/repos/realm/realm-java/issues/761","id":203774619,"user":{"login":"samyakjain","id":1956129,"avatar_url":"https://avatars.githubusercontent.com/u/1956129?v=3","gravatar_id":"","url":"https://api.github.com/users/samyakjain","html_url":"https://github.com/samyakjain","followers_url":"https://api.github.com/users/samyakjain/followers","following_url":"https://api.github.com/users/samyakjain/following{/other_user}","gists_url":"https://api.github.com/users/samyakjain/gists{/gist_id}","starred_url":"https://api.github.com/users/samyakjain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samyakjain/subscriptions","organizations_url":"https://api.github.com/users/samyakjain/orgs","repos_url":"https://api.github.com/users/samyakjain/repos","events_url":"https://api.github.com/users/samyakjain/events{/privacy}","received_events_url":"https://api.github.com/users/samyakjain/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T06:19:25Z","updated_at":"2016-03-31T06:19:25Z","body":"+1"}}