Groovy / Grails - Jollyday CalenderUtil - 没有签名的方法

时间:2014-08-22 12:55:01

标签: java grails groovy gregorian-calendar missingmethodexception

我的项目有点问题:

  
    

URI         / TimeKeeper的/日历/显示

         

        groovy.lang.MissingMethodException

         

消息         没有方法签名:static de.jollyday.util.CalendarUtil.create()适用于参数类型:(java.util.GregorianCalendar)值:      [java.util.GregorianCalendar中的[时间= 1406897280000,areFieldsSet = TRUE,areAllFieldsSet = TRUE,宽松= TRUE,区= sun.util.calendar.ZoneInfo [ID = “欧洲/柏林”,偏移量= 3600000,dstSavings = 3600000,useDaylight =真,过渡= 143,lastRule = java.util.SimpleTimeZone中[ID =欧洲/柏林,偏移= 3600000,dstSavings = 3600000,useDaylight =真,startYear = 0,STARTMODE = 2,startMonth = 2,朝九特派= -1, startDayOfWeek = 1,开始时间= 3600000,startTimeMode = 2,endMode = 2,endMonth = 9,endday指定= -1,一个endDayOfWeek = 1,结束时间= 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')
    }

...

有人可以告诉我出了什么问题吗?

谢谢:)

1 个答案:

答案 0 :(得分: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')
}

这就是解决方案