Navigation Menu

Skip to content

Commit

Permalink
Add comment and use better string conversion for enum valueOf call
Browse files Browse the repository at this point in the history
  • Loading branch information
grkvlt committed Apr 17, 2014
1 parent 18a557e commit 29dc14e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/brooklyn/util/flags/TypeCoercions.java
Expand Up @@ -154,8 +154,9 @@ public static <T> T coerce(Object value, TypeToken<T> targetTypeToken) {
}
}

//for enums call valueOf with the string representation of the value
if (targetType.isEnum()) {
T result = (T) stringToEnum((Class<Enum>) targetType, null).apply(value.toString());
T result = (T) stringToEnum((Class<Enum>) targetType, null).apply(String.valueOf(value));
if (result != null) return result;
}

Expand Down

0 comments on commit 29dc14e

Please sign in to comment.