我的Groovy脚本中有这些全局变量
@Field ZonedDateTime currentDateTime = ZonedDateTime.now(ZoneId.of("UTC"))
@Field DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
但是我似乎无法在脚本的类内部访问它:(
class SmsMessageDeliveryPartResult {
String dateSent
String dateDeliveryReceiptReceived
DeliveryResult() {
this.dateSent = currentDateTime.format(formatter)
this.dateDeliveryReceiptReceived = currentDateTime.format(formatter)
}
}
我收到此错误:
Caught: groovy.lang.MissingPropertyException: No such property: currentDateTime for class: