File2 특성 사용
정규식(regex)을 사용하여 문자열 패턴을 생성할 때 FILE2 특성을 사용할 수 있습니다. 이것은 파일을 식별하는 데 유용하며 파일 경로를 지원합니다.
예: FILE2 특성 유형
index, type, LocalFile, label, 선택적 설명과 같은 FILE2 사용의 값을 정의합니다.
@BotCommand
@CommandPkg(label = "[[File2TypeDemo.label]]",
description = "[[File2TypeDemo.description]]", icon = "sample.svg", name = "file2TypeDemo")
public class File2TypeDemo {
private static Logger logger = LogManager.getLogger(File2TypeDemo.class);
@Execute
public void regexFile(
@Idx(index = "1", type = AttributeType.FILE2)
@Pkg(label = "[[File2TypeDemo.localFile.label]]")
@NotEmpty
@LocalFile
FileValue fileValue)
{
if (fileValue.isRegex()) {
RegexFile regexFile = fileValue.getRegex();
logger.debug("folder name {}", regexFile.getFolder());
logger.debug("local file location {}", regexFile.getFileNamePattern().toString());
}
else {
logger.debug("Regex option is not selected");
}
}