Package SDK를 사용하여 사용자 지정 변수 생성
- 최종 업데이트2022/05/19
Automation 360를 사용할 때 SDK 패키지를 사용하여 사용자 지정 변수를 만들 수 있습니다.
사용자 지정 변수 사용
Automation 360를 사용하여 사용자 지정 변수를 생성합니다. 이것은 시스템 변수이며, 읽기 전용이고 값이 할당되는 대신 계산되는 것을 제외하고 다른 봇 변수로 사용됩니다.
필요한 주석 기호
변수를 생성하려면 다음 주석 기호가 필요합니다.
사용 사례 예시
다음 사용 사례는 시스템 기본 영역의 현재 시간을 반환하는 방법을 보여줍니다.
- 비즈니스 로직을 사용하여 POJO 클래스를 만듭니다.
public class Now { public DateTimeValue now() { Instant instant = Instant.now(); ZonedDateTime now = instant.atZone(ZoneId.systemDefault()); return new DateTimeValue(now); } }
- POJO 클래스에 주석 기호를 지정하여 Automation 360 변수에 대해 이를 활성화하고 패키지를 만듭니다.
@BotCommand(commandType = BotCommand.CommandType.Variable) @CommandPkg(description = "The current datetime at system default zone.", name = "Now", label = "", variable_return_type = DataType.DATETIME) public class Now { public DateTimeValue now() { Instant instant = Instant.now(); ZonedDateTime now = instant.atZone(ZoneId.systemDefault()); return new DateTimeValue(now); } }
- 실행 메소드임을 나타내는
now
메소드에 주석 기호를 지정합니다.@VariableExecute public DateTimeValue now() { Instant instant = Instant.now(); ZonedDateTime now = instant.atZone(ZoneId.systemDefault()); return new DateTimeValue(now); }
모든 변수에는 하나의 테스트
VariableExecute
메소드가 있어야 합니다.