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 Details

    • 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 interface PathConstraint
      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 interface FileNameConstraint
      Parameters:
      fileName - the filename to validate
      path - the path the filename is part of. This is supplied for context and is not validated