本文整理汇总了Java中org.sejda.model.parameter.base.SingleOutputTaskParameters类的典型用法代码示例。如果您正苦于以下问题:Java SingleOutputTaskParameters类的具体用法?Java SingleOutputTaskParameters怎么用?Java SingleOutputTaskParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SingleOutputTaskParameters类属于org.sejda.model.parameter.base包,在下文中一共展示了SingleOutputTaskParameters类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValid
import org.sejda.model.parameter.base.SingleOutputTaskParameters; //导入依赖的package包/类
@Override
public boolean isValid(SingleOutputTaskParameters value, ConstraintValidatorContext context) {
if (nonNull(value)) {
if (isNull(value.getOutput())) {
return false;
}
if (isNull(value.getOutput().getDestination()) || (value.getOutput().getDestination().exists()
&& (value.getExistingOutputPolicy() == ExistingOutputPolicy.FAIL
|| value.getExistingOutputPolicy() == ExistingOutputPolicy.SKIP))) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(
String.format("File destination already exists: %s.", value.getOutput().getDestination()))
.addConstraintViolation();
return false;
}
}
return true;
}
示例2: isValid
import org.sejda.model.parameter.base.SingleOutputTaskParameters; //导入依赖的package包/类
@Override
public boolean isValid(SingleOutputTaskParameters value, ConstraintValidatorContext context) {
if (nonNull(value) && nonNull(value.getOutput()) && ArrayUtils.isNotEmpty(extensions)) {
String fileName = value.getOutput().getDestination().getName();
if (hasAllowedExtension(fileName)) {
return true;
}
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(
String.format("The output '%s' is not one of the expected types: %s", fileName,
ArrayUtils.toString(extensions))).addNode("taskOutput").addConstraintViolation();
return false;
}
return true;
}
示例3: pdfOutputTo
import org.sejda.model.parameter.base.SingleOutputTaskParameters; //导入依赖的package包/类
/**
* Initialize the given params with a {@link FileTaskOutput}
*
* @param params
* @return
*/
public TaskTestContext pdfOutputTo(SingleOutputTaskParameters params) throws IOException {
this.fileOutput = File.createTempFile("SejdaTest", ".pdf");
this.fileOutput.deleteOnExit();
params.setOutput(new FileTaskOutput(fileOutput));
return this;
}
示例4: fileOutputTo
import org.sejda.model.parameter.base.SingleOutputTaskParameters; //导入依赖的package包/类
/**
* Initialize the given params with a {@link FileTaskOutput} on a file with the given extension
*
* @param params
* @param extension
* @return
* @throws IOException
*/
public TaskTestContext fileOutputTo(SingleOutputTaskParameters params, String extension) throws IOException {
this.fileOutput = File.createTempFile("SejdaTest", extension);
this.fileOutput.deleteOnExit();
params.setOutput(new FileTaskOutput(fileOutput));
return this;
}