Class PathLengthConstraint
- java.lang.Object
-
- edu.wisc.library.ocfl.core.path.constraint.PathLengthConstraint
-
- All Implemented Interfaces:
FileNameConstraint,PathConstraint
public class PathLengthConstraint extends Object implements PathConstraint, FileNameConstraint
Validates that a path or filename are not longer than a fixed number of characters or bytes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPathLengthConstraint.Type
-
Constructor Summary
Constructors Constructor Description PathLengthConstraint(int maxLength, PathLengthConstraint.Type type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(String path)Validates that a path meets a defined constraintvoidapply(String fileName, String path)Validates that a filename meets a defined constraintstatic PathLengthConstraintmaxBytes(int maxLength)Creates a new constraint that limits the number of bytes in a pathstatic PathLengthConstraintmaxChars(int maxLength)Creates a new constraint that limits the number of characters in a path
-
-
-
Constructor Detail
-
PathLengthConstraint
public PathLengthConstraint(int maxLength, PathLengthConstraint.Type type)
-
-
Method Detail
-
maxChars
public static PathLengthConstraint maxChars(int maxLength)
Creates a new constraint that limits the number of characters in a path- Parameters:
maxLength- maximum number of characters- Returns:
- constraint
-
maxBytes
public static PathLengthConstraint maxBytes(int maxLength)
Creates a new constraint that limits the number of bytes in a path- Parameters:
maxLength- maximum number of bytes- Returns:
- constraint
-
apply
public void apply(String path)
Validates that a path meets a defined constraint- Specified by:
applyin interfacePathConstraint- Parameters:
path- the path to validate
-
apply
public void apply(String fileName, String path)
Validates that a filename meets a defined constraint- Specified by:
applyin interfaceFileNameConstraint- Parameters:
fileName- the filename to validatepath- the path the filename is part of. This is supplied for context and is not validated
-
-