Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[attribute][complex] extend to java.util.Map #130

Merged
merged 1 commit into from
Mar 2, 2017
Merged

Conversation

yannmh
Copy link
Member

@yannmh yannmh commented Mar 2, 2017

Add java.util.Map to the list of supported JMXComplexAttribute
types.

Fix #125

@yannmh yannmh added this to the 0.13.0 milestone Mar 2, 2017
@yannmh yannmh self-assigned this Mar 2, 2017
@yannmh yannmh requested a review from olivielpeau March 2, 2017 18:45
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 as long as you can confirm it works well ;)

@yannmh yannmh force-pushed the yann/map-support branch from aff1ee5 to e0cda84 Compare March 2, 2017 19:19
@@ -34,7 +34,7 @@ private void populateSubAttributeList(Object attributeValue) {
for (String key : data.getCompositeType().keySet()) {
this.subAttributeList.put(key, new HashMap<String, Object>());
}
} else if ("java.util.HashMap".equals(attributeType)) {
} else if (("java.util.HashMap".equals(attributeType)) || ("java.util.Map".equals(attributeType))){
HashMap<String, Double> data = (HashMap<String, Double>) attributeValue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this cast will work in the general case when the underlying attributeValue object is not a HashMap.

Have you tested this with a non-HashMap Map?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we could probably just cast attributeValue to a Map right?)

same applies to your change line 86

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right it should stay a Map

Add `java.util.Map` to the list of supported `JMXComplexAttribute`
types.
@yannmh yannmh force-pushed the yann/map-support branch from e0cda84 to dcff359 Compare March 2, 2017 20:07
@yannmh yannmh merged commit dfc5698 into master Mar 2, 2017
@yannmh yannmh deleted the yann/map-support branch March 2, 2017 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants