Package io.ocfl.core.path.constraint
Class BeginEndPathConstraint
- java.lang.Object
-
- io.ocfl.core.path.constraint.BeginEndPathConstraint
-
- All Implemented Interfaces:
FileNameConstraint
,PathConstraint
public class BeginEndPathConstraint extends Object implements PathConstraint, FileNameConstraint
Validates that a path or filename does or does not begin or and with a specified value
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(String path)
Validates that a path meets a defined constraintvoid
apply(String fileName, String path)
Validates that a filename meets a defined constraintstatic BeginEndPathConstraint
mustBeginWith(String prefix)
Creates a new constraint that validates that a path DOES begin with a specified prefixstatic BeginEndPathConstraint
mustEndWith(String suffix)
Creates a new constraint that validates that a path DOES end with a specified suffixstatic BeginEndPathConstraint
mustNotBeginWith(String prefix)
Creates a new constraint that validates that a path DOES NOT begin with a specified prefixstatic BeginEndPathConstraint
mustNotEndWith(String suffix)
Creates a new constraint that validates that a path DOES NOT end with a specified suffix
-
-
-
Method Detail
-
mustNotEndWith
public static BeginEndPathConstraint mustNotEndWith(String suffix)
Creates a new constraint that validates that a path DOES NOT end with a specified suffix- Parameters:
suffix
- the suffix to test for- Returns:
- constraint
-
mustEndWith
public static BeginEndPathConstraint mustEndWith(String suffix)
Creates a new constraint that validates that a path DOES end with a specified suffix- Parameters:
suffix
- the suffix to test for- Returns:
- constraint
-
mustNotBeginWith
public static BeginEndPathConstraint mustNotBeginWith(String prefix)
Creates a new constraint that validates that a path DOES NOT begin with a specified prefix- Parameters:
prefix
- the prefix to test for- Returns:
- constraint
-
mustBeginWith
public static BeginEndPathConstraint mustBeginWith(String prefix)
Creates a new constraint that validates that a path DOES begin with a specified prefix- Parameters:
prefix
- the prefix to test for- Returns:
- constraint
-
apply
public void apply(String path)
Validates that a path meets a defined constraint- Specified by:
apply
in 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:
apply
in interfaceFileNameConstraint
- Parameters:
fileName
- the filename to validatepath
- the path the filename is part of. This is supplied for context and is not validated
-
-