Class BitSetPathCharConstraint
- java.lang.Object
-
- edu.wisc.library.ocfl.core.path.constraint.BitSetPathCharConstraint
-
- All Implemented Interfaces:
PathCharConstraint
public class BitSetPathCharConstraint extends Object implements PathCharConstraint
Constraint that applies restrictions on what characters are allowed in file names.
-
-
Constructor Summary
Constructors Constructor Description BitSetPathCharConstraint(boolean blockList, BitSet charSet)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BitSetPathCharConstraintacceptList(char... chars)Creates a constraint that only accepts the specified charactersstatic BitSetPathCharConstraintacceptListRange(char start, char end)Creates a constraint that accepts all of the characters in the given rangevoidapply(char c, String path)Validates that the characters in a filename meet a defined constraintstatic BitSetPathCharConstraintblockList(char... chars)Creates a constraint that rejects the specified charactersstatic BitSetPathCharConstraintblockListRange(char start, char end)Creates a constraint that rejects all of the characters in the given range
-
-
-
Constructor Detail
-
BitSetPathCharConstraint
public BitSetPathCharConstraint(boolean blockList, BitSet charSet)
-
-
Method Detail
-
blockList
public static BitSetPathCharConstraint blockList(char... chars)
Creates a constraint that rejects the specified characters- Parameters:
chars- the characters to reject- Returns:
- constraint
-
blockListRange
public static BitSetPathCharConstraint blockListRange(char start, char end)
Creates a constraint that rejects all of the characters in the given range- Parameters:
start- beginning of range, inclusiveend- end of range, inclusive- Returns:
- constraint
-
acceptList
public static BitSetPathCharConstraint acceptList(char... chars)
Creates a constraint that only accepts the specified characters- Parameters:
chars- the characters to accept- Returns:
- constraint
-
acceptListRange
public static BitSetPathCharConstraint acceptListRange(char start, char end)
Creates a constraint that accepts all of the characters in the given range- Parameters:
start- beginning of range, inclusiveend- end of range, inclusive- Returns:
- constraint
-
apply
public void apply(char c, String path)Validates that the characters in a filename meet a defined constraint- Specified by:
applyin interfacePathCharConstraint- Parameters:
c- the character to validatepath- the path the character is part of. This is supplied for context and is not validated
-
-