具体回答你的问题,你可以在Address
使用@Field("line1")
为street
。
我已经在我的项目是这样的,它工作正常(见descriptions
)
1级
@Document
@JsonInclude(JsonInclude.Include.NON_NULL)
public class HotelInfo {
@Field("hotel_type") @JsonProperty("hotel_type")
public String hotelType;
@Field @JsonProperty("images")
public List<Image> images = new ArrayList<Image>();
@Field @JsonProperty("regions")
public List<String> regions = new ArrayList<String>();
@Field @JsonProperty("themes")
public List<String> themes = new ArrayList<String>();
@Field @JsonProperty("facilities")
public List<String> facilities;
@Field @JsonProperty("descriptions")
public Descriptions descriptions;
}
2级
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Descriptions {
@Field("hotel_information") @JsonProperty("hotel_information")
public String hotelInformation;
}
你试过@Field(NAME =” line1“) – Koitoer
不,因为我想知道重命名支持有多远。我可以在查询中使用重命名的字段吗? –
我不认为我在开发过程中测试了这个用例,所以我不会把它作为答案,但它应该与内部类中字段的注释一起工作,并且派生查询应该使用Java名称并获取转换为N1QL中的别名 –