You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great library ,I am using this library for a while now (since 0.12-SNAPSHOT) , and it is working like a charm. (At present i am using 0.16-SNAPSHOT)
Recently I am facing a problem with my one of the Use cases, let me place my code first
# User class
public class User {
private String name;
private String emailId;
private String mobileNo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
}
# ScreenInfoPojo class
public class ScreenInfoPojo {
private Long id;
private String name;
private ScreenInfoPojo parentScreen;
private User createdBy;
private User lastUpdatedBy;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ScreenInfoPojo getParentScreen() {
return parentScreen;
}
public void setParentScreen(ScreenInfoPojo parentScreen) {
this.parentScreen = parentScreen;
}
public User getCreatedBy() {
return createdBy;
}
public void setCreatedBy(User createdBy) {
this.createdBy = createdBy;
}
public User getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(User lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
#Problem
In my use case I have a class ScreenInfoPojo which refers to same class as parentScreen ,
I am trying to fetch specific field/fields of parent ( "parentScreen.id") instate I am getting all fields that I have defined on child/target Object ("id","name","createdBy.name","lastUpdatedBy.mobileNo","parentScreen.id") and parent response is again recursive ! One thing i observed that It is only happening in case of a class has its own reference , I placed User class reference as two different field createdBy and lastUpdatedBy and tried to fetch "name" and "mobileNo" respectively worked just fine.
Can you suggest any solution for this problem?
Thanks
The text was updated successfully, but these errors were encountered:
So this isn't possible in the latest release, for good reason. There are two ways that patterns can be matched: by explicit class association and by the dot-path. In the current implementation, the class matcher is always chosen first because it's explicitly detailing what fields on the class to match.
However, in your case it's somewhat problematic. To support this, I've added a behavior selector at the JsonViewModule level and the JsonView level. It will default to the current behavior (CLASS_FIRST), but you can optionally set it to PATH_FIRST which should do what you want.
This is a great library ,I am using this library for a while now (since 0.12-SNAPSHOT) , and it is working like a charm. (At present i am using 0.16-SNAPSHOT)
Recently I am facing a problem with my one of the Use cases, let me place my code first
# User class
# ScreenInfoPojo class
# Run code
# Result
#Expected Result
#Problem
In my use case I have a class ScreenInfoPojo which refers to same class as parentScreen ,
I am trying to fetch specific field/fields of parent ( "parentScreen.id") instate I am getting all fields that I have defined on child/target Object ("id","name","createdBy.name","lastUpdatedBy.mobileNo","parentScreen.id") and parent response is again recursive ! One thing i observed that It is only happening in case of a class has its own reference , I placed User class reference as two different field createdBy and lastUpdatedBy and tried to fetch "name" and "mobileNo" respectively worked just fine.
Can you suggest any solution for this problem?
Thanks
The text was updated successfully, but these errors were encountered: