Skip to content
This repository was archived by the owner on Apr 1, 2019. It is now read-only.

Conversation

@padcom
Copy link

@padcom padcom commented Jul 2, 2015

Hi,

sometimes the content returned is a constant true/false. Since there is no way to set the content type for TextResource I've created the "toBoolean" method on JSONResource that simply casts the unmarshaled object to boolean.

I need this since the service I am integrating with is very strict in the content it accepts and can produce (application/json and nothing else) and returns a true/false value.

Best regards,
Matthias.

@padcom
Copy link
Author

padcom commented Jul 2, 2015

I've had problems building the solution because of some GPG plugin problem but I've tested the pull request otherwise directly from Eclipse and it worked OK.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think unmarshal() should only be called if it hasn't been unmarshalled already, and the value cached in json be cast and returned

if (json == null) unmarshal();
return (boolean)json;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants