damnhandy / Handy-URI-Templates

A Java URI Template processor implementing RFC6570
https://damnhandy.github.io/Handy-URI-Templates/
Other
203 stars 37 forks source link

Expanding enums #35

Closed vicmosin closed 9 years ago

vicmosin commented 9 years ago

Why forbid to pass enums??

https://github.com/damnhandy/Handy-URI-Templates/blob/master/src/main/java/com/damnhandy/uri/template/DefaultVarExploder.java#L120

damnhandy commented 9 years ago

Enums wouldn't be captured there, but here:

https://github.com/damnhandy/Handy-URI-Templates/blob/master/src/main/java/com/damnhandy/uri/template/UriTemplate.java#L609

The DefaultVarExploder should only be called when the type is not a primitive, CharSequence, Number, or Date type. I haven't tested enums, but there probably needs to be some thought into how they are handled.

vicmosin commented 9 years ago

So they are not)) it fails with The value must an object exception

damnhandy commented 9 years ago

Clearly not tested :) I'll have a gander at this over the weekend.

damnhandy commented 9 years ago

@vicmosin I'm really surprised that such an obvious bug took 4 years for someone to find it. Thanks for the report. A few minor tweaks and it's functional now. I've pushed a snapshot to Maven Central under version 2.1.0-SNAPSHOT Should have a release out by the end of the weekend.

vicmosin commented 9 years ago

Confirmed, 2.1.0-SNAPSHOT fixes the issue. What about 2.0.5-SNAPSHOT described in docs?

damnhandy commented 9 years ago

I'm going straight to 2.1. Should be posting that later today.