我想映射以下类
class Schedule {
ZoneId timezoneId;
List<AvailabilityRule> rules;
}
Run Code Online (Sandbox Code Playgroud)
class AvailabilityRule {
long startEpoch;
long endEpoch;
}
Run Code Online (Sandbox Code Playgroud)
到这些课程。
class ScheduleDTO {
String timezone;
List<AvailabilityRuleDTO> rules;
}
Run Code Online (Sandbox Code Playgroud)
class AvailabilityRuleDTO {
ZonedDateTime startTime;
ZonedDateTime endTime;
}
Run Code Online (Sandbox Code Playgroud)
timezoneId计算时startEpoch需要和startTime。
Instant instant = Instant.ofEpochMilli(startEpoch);
ZonedDateTime zonedDateTime = instant.atZone(timezoneId);
Run Code Online (Sandbox Code Playgroud)
我如何使用mapstruct 来实现这一点?
我想要的伪代码
@Mapping(source = {"startEpoch", "timezoneId"}, target = "startTime", qualifiedByName = "epochToString")
AvailabilityRuleDTO toAvailabilityRuleDTO(AvailabilityRule
availabilityRule, Schedule schedule);
Run Code Online (Sandbox Code Playgroud) 我有一个游戏的 Haskell 代码,可以在这里找到完整的代码。
以下是BoardMain.hs
{-# Language MultiParamTypeClasses, FunctionalDependencies #-}
import Control.Monad.Trans (liftIO)
import Graphics.UI.Gtk
import Graphics.UI.Gtk.Layout.BackgroundContainer
import Graphics.UI.Gtk.Board.BoardLink
import GtkPegSolitaire
attemptDragStart :: Board Int Tile Peg -> (Int, Int) -> IO Bool
attemptDragStart _ _ = return True
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我收到以下错误
BoardMain.hs:39:21: error:
Not in scope: type constructor or class ‘Board’
BoardMain.hs:39:31: error:
Not in scope: type constructor or class ‘Tile’
BoardMain.hs:39:36: error:
Not in scope: type constructor or class ‘Peg’
Run Code Online (Sandbox Code Playgroud)
我知道我犯了一个小错误。任何帮助表示赞赏。
GtkPegSolitaire.hs并且PegSolitaire.hs,可以发现这里
我编写了一个非常基本的苹果脚本,该脚本打开iTerm并转到文件:
tell application "iTerm"\n activate\n do script "cd ~" in tab 1\nend tell\nRun Code Online (Sandbox Code Playgroud)\n\n但是,如果我尝试运行它,我会得到Syntax Error:
Expected end of line, etc. but found \xe2\x80\x9cscript\xe2\x80\x9d.\nRun Code Online (Sandbox Code Playgroud)\n\n知道为什么会这样吗?
\n\n该脚本中是否存在一些不正确的语法?
\n