Package com.adaptris.interlok.util
Class FileFilterBuilder
- java.lang.Object
-
- com.adaptris.interlok.util.FileFilterBuilder
-
public abstract class FileFilterBuilder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_FILE_FILTER_IMP
protected static java.util.Map<java.lang.Class,java.util.function.Function<java.lang.String,java.lang.Object>>
SUPPORTED_CNST_ARGS
-
Constructor Summary
Constructors Constructor Description FileFilterBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.FileFilter
build(java.lang.String filterExpression, java.lang.String filterImpl)
Build a file filter implementation based on the parameters
-
-
-
Method Detail
-
build
public static java.io.FileFilter build(java.lang.String filterExpression, java.lang.String filterImpl)
Build a file filter implementation based on the parameters- If filterExpression is empty and filterImpl is the default '' then a functional filter that accepts all inputs is returned
- If filterExpression is empty and filterImpl is not the default, then we attempt to use the
default no-args constructor using
Class.forName(filterImpl).newInstance()
. If there isn't an accessible no-args constructor, then a RuntimeException is thrown. - If filterExpression is not empty, then we attempt to convert the the filterExpression into something that is supported by the declared constructors from the class. If conversion fails, then a RuntimeException will be thrown.
- If filterImpl is empty, then a RuntimeException exception is thrown
- Parameters:
filterExpression
- the filter expression suitable for the implementation in questionfilterImpl
- the class implementingFileFilter
.- Returns:
- a FileFilter implementation (hopefully never null).
-
-