Skip to content

Commit

Permalink
Merge pull request thiagolocatelli#63 from giovanymoreno/feature/gene…
Browse files Browse the repository at this point in the history
…ric-parse-object

Allow getParseObject() to return type variables that extend ParseObject
  • Loading branch information
thiagolocatelli authored Aug 18, 2016
2 parents bfa9fd3 + 041de0a commit 200b295
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/parse4j/ParseObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ public <T> List<T> getList(String key) {
return returnValue;
}

public ParseObject getParseObject(String key) {
@SuppressWarnings("unchecked")
public <T extends ParseObject> T getParseObject(String key) {
if (!this.data.containsKey(key)) {
return null;
}
Expand All @@ -243,7 +244,7 @@ public ParseObject getParseObject(String key) {
LOGGER.error("Called getParseObject(\"{}\") but the value is a {}", key, value.getClass());
return null;
}
return (ParseObject) value;
return (T) value;
}

public Object get(String key) {
Expand Down

0 comments on commit 200b295

Please sign in to comment.