kotlin 1.2.10 jackson-module-kotlin:2.9.0
我在kotlin中有以下数据类:
data class CurrencyInfo(
@JsonProperty("currency_info") var currencyInfo: CurrencyInfoItem?
)
@JsonInclude(JsonInclude.Include.NON_NULL)
data class CurrencyInfoItem(
@JsonProperty("iso_4217") var iso4217: String?,
@JsonProperty("name") var name: String?,
@JsonProperty("name_major") var nameMajor: String?,
@JsonProperty("name_minor") var nameMinor: String?,
@JsonProperty("i_ma_currency") var iMaCurrency: Int?,
@JsonProperty("i_merchant_account") var iMerchantAccount: Int?,
@JsonProperty("i_x_rate_source") var iXRateSource: Int?,
@JsonProperty("base_units") var baseUnits: Double?,
@JsonProperty("min_allowed_payment") var minAllowedPayment: Int?,
@JsonProperty("decimal_digits") var decimalDigits: Int?,
@JsonProperty("is_used") var isUsed: Boolean?
)
Run Code Online (Sandbox Code Playgroud)
当我尝试反序列化此数据类时,我得到以下内容:
{"currency_info":{"iso_4217":"CAD","name":"Canadian Dollar","imerchantAccount":0,"ixrateSource":2}}
Run Code Online (Sandbox Code Playgroud)
如您所见,最后两个选项被错误地反序列化.可以通过直接向getter @get:JsonProperty添加注释来解决此问题.但是,根据jackson docs @JsonProperty应该分配给getter/setters/fields
所以,我想问一下是否有一种可靠的方法来为kotlin中的jackson注释属性以进行正确的序列化/反序列化(而且我的所有数据类都是自动生成的,因此很难创建一些两/三行注释,分别用于getter和二传手)
否则,一些杰克逊设置可以解决这个问题吗?
根据下面的答案,以下为我工作
private val mapper = ObjectMapper().registerKotlinModule()
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.NONE) …Run Code Online (Sandbox Code Playgroud) 我随机面对ExtJS5输入字段中缺少第一个字符的问题,同时通过sendKeys方法发送字符串.
系统信息:Ubuntu 14.04 - >带有selenium网格的docker容器(2.48.2)浏览器Firefox
代码很简单.我只是获取输入web元素,等待它是可点击的(即isEnabled和isDisplay),清除并发送字符串:
wait.until(ExpectedConditions.elementToBeClickable(input)).clear();
input.sendKeys(value);
Run Code Online (Sandbox Code Playgroud)
输入元素也很简单:
<input id="textfield-1455-inputEl" data-ref="inputEl" type="text" role="textbox" size="1" name="name" class="x-form-field x-form-required-field x-form-text x-form-text-default x-form-focus x-field-form-focus x-field-default-form-focus" autocomplete="off" componentid="textfield-1455"/>
Run Code Online (Sandbox Code Playgroud)
我注意到问题仅发生在页面上执行的第一个sendKeys():
页面上发生的其他sendKeys是稳定的.
我找了类似的问题.它似乎不是特殊字符的问题(缺少字符示例:46-> 6; coverTest - > overTest; 1 - >没有);
此外,由于远程webdriver基础结构,我不认为这是一个缺少字符的问题.测试失败,但在确切的地方.
我知道我可以使用sendKeys(),然后检查输入的值并重复发送操作.但是,这是最后一个选择.
是否需要对ExtJS输入(DOM中的任何属性)进行任何额外检查以确保输入字段已准备好?
感谢您的帮助.