Skip to content

Commit

Permalink
[Issue #524] Used constructor with ObjectIdResolver in ObjectIdInfo.w…
Browse files Browse the repository at this point in the history
…ithAlwaysAsId(...) + Unit test
  • Loading branch information
Petr Kokorev committed Aug 19, 2014
1 parent e88a87c commit e5422d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ObjectIdInfo
{
protected final PropertyName _propertyName;
protected final Class<? extends ObjectIdGenerator<?>> _generator;
private final Class<? extends ObjectIdResolver> _resolver;
protected final Class<? extends ObjectIdResolver> _resolver;
protected final Class<?> _scope;
protected final boolean _alwaysAsId;

Expand Down Expand Up @@ -60,7 +60,7 @@ public ObjectIdInfo withAlwaysAsId(boolean state) {
if (_alwaysAsId == state) {
return this;
}
return new ObjectIdInfo(_propertyName, _scope, _generator, state);
return new ObjectIdInfo(_propertyName, _scope, _generator, state, _resolver);
}

public PropertyName getPropertyName() { return _propertyName; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.annotation.ObjectIdResolver;
Expand Down Expand Up @@ -140,6 +141,7 @@ static class CustomResolutionWrapper {
}

@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", resolver = PoolResolver.class)
@JsonIdentityReference(alwaysAsId = true) // #524
static class WithCustomResolution {
public int id;
public int data;
Expand Down

0 comments on commit e5422d2

Please sign in to comment.