Groovy/Grails - Jollyday CalenderUtil - 没有方法签名
Posted
技术标签:
【中文标题】Groovy/Grails - Jollyday CalenderUtil - 没有方法签名【英文标题】:Groovy/Grails - Jollyday CalenderUtil - No signature of method 【发布时间】:2014-10-16 08:08:23 【问题描述】:我的项目有点问题:
URI /TimeKeeper/日历/显示
类 groovy.lang.MissingMethodException
留言 没有方法签名:静态 de.jollyday.util.CalendarUtil.create() 适用于参数类型:(java.util.GregorianCalendar) 值: [java.util.GregorianCalendar[time=1406897280000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight =true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1, startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1 ,YEAR=2014,MONTH=7,WEEK_OF_YEAR=31,WEEK_OF_MONTH=0,DAY_OF_MONTH=1,DAY_OF_YEAR=213,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=2,HOUR_OF_DAY=14,MINUTE=48,SECOND =0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]] 可能的解决方案:create(), create(java.util.Calendar), create(int, de.jollyday.config.Fixed), create(int, int , int), create(int, int, int, org.joda.time.Chronology), grep()
这就是我抛出异常的代码:
import static java.util.Calendar.*
import de.jollyday.*
import de.jollyday.util.*
class DayReport
def day
def records
def getHolidayName()
def m = HolidayManager.getInstance(HolidayCalendar.GERMANY)
def holidays = m.getHolidays(day.get(YEAR), 'nw')
holidays.find
CalendarUtil.create(day) == it.date
?.description
def isHoliday()
def m = HolidayManager.getInstance(HolidayCalendar.GERMANY)
def create = CalendarUtil.create(day)
println "DayReport isHoliday: $create.getClass()"
m.isHoliday(create, 'nw')
...
谁能告诉我怎么回事?
谢谢:)
【问题讨论】:
奇怪...尝试将您的一天投射到日历:CalendarUtil.create(day as Calendar)
这也不行。我用 org.joda.time.LocalDate 而不是 CalendarUtil 修复了它。
【参考方案1】:
def getHolidayName()
def m = HolidayManager.getInstance(HolidayCalendar.GERMANY)
def holidays = m.getHolidays(day.get(YEAR), 'nw')
holidays.find
new LocalDate(day.getTime()) == new LocalDate(it.date)
?.description
def isHoliday()
def m = HolidayManager.getInstance(HolidayCalendar.GERMANY)
def localDate = new LocalDate(day.getTime())
println "localDate: " + localDate
m.isHoliday(localDate, 'nw')
这就是解决办法
【讨论】:
以上是关于Groovy/Grails - Jollyday CalenderUtil - 没有方法签名的主要内容,如果未能解决你的问题,请参考以下文章
Spring Tool Suite 和 Groovy/Grails Tool Suite 的区别
在 Grails 中使用 Groovy-Eclipse 插件进行开发
通过 Groovy/Grails 检测平台(Window 或 Linux)