Package com._1c.g5.v8.dt.xml
Class UnsupportedFilesCopyVisitor.Builder
- java.lang.Object
-
- com._1c.g5.v8.dt.xml.UnsupportedFilesCopyVisitor.Builder
-
- Enclosing class:
- UnsupportedFilesCopyVisitor
public static class UnsupportedFilesCopyVisitor.Builder extends Object
A builder for creating file copy visitor instances.Example to copy visitor what convert all xml to '\n' line feeds and escape all files with "trash" word in path:
static final Predicate<Path> xmlFilePredicate = UnsupportedFilesCopyVisitor.FileExtensionPredicateBuilder.build(".xml"); static final UnsupportedFilesCopyVisitor VISITOR = new UnsupportedFilesCopyVisitor.Builder(sourcePath, targetPath) .putModifier(xmlFilePredicate, ConvertOption.TO_LF) .addEscaper(p -> p.toString().contains("trash")) .build();
Builder instances can be reused - it is safe to call
build()
multiple times to build multiple copy visitors in series.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnsupportedFilesCopyVisitor.Builder
addExclusion(Predicate<Path> exclusion)
Add exclusion for skip visited files by specifed predicateUnsupportedFilesCopyVisitor
build()
Build a file copy visitor instancesUnsupportedFilesCopyVisitor.Builder
putModifier(Predicate<Path> pathPredicate, LineFeedConverter.ConvertOption... convertOptions)
Put modifier rules for visited files by specifed predicate
-
-
-
Method Detail
-
addExclusion
public UnsupportedFilesCopyVisitor.Builder addExclusion(Predicate<Path> exclusion)
Add exclusion for skip visited files by specifed predicate- Parameters:
exclusion
- the rule of exclusion, cannot benull
- Returns:
- current builder instance, never
null
-
putModifier
public UnsupportedFilesCopyVisitor.Builder putModifier(Predicate<Path> pathPredicate, LineFeedConverter.ConvertOption... convertOptions)
Put modifier rules for visited files by specifed predicate- Parameters:
pathPredicate
- the rule of filter of file paths, cannot benull
, duplicate rules are not allowed, and will causebuild()
to fail.convertOptions
- theLineFeedConverter.ConvertOption
sequences was apply for filtered files, cannot benull
, usedLineFeedConverter.convert(String, ConvertOption...)
- Returns:
- current builder instance, never
null
- See Also:
LineFeedConverter
-
build
public UnsupportedFilesCopyVisitor build()
Build a file copy visitor instances- Returns:
- configured file copy visitor, never
null
-
-