Approval

public class Approval<T>

The main entry point class for each approval process. This is the main service class that is doing the hard work - it calls other classes for custom logic based on the object that is approved. Created by nikolavp on 1/29/14.

Parameters:
  • <T> – the type of the object that will be approved by this Approval

Constructors

Approval

Approval(Reporter reporter, Converter<T> converter, PathMapper<T> pathMapper)

Create a new object that will be able to approve “things” for you.

Parameters:
  • reporter – a reporter that will be notified as needed for approval events
  • converter – a converter that will be responsible for converting the type for approval to raw form
  • pathMapper – the path mapper that will be used

Approval

Approval(Reporter reporter, Converter<T> converter, PathMapper<T> pathMapper, com.nikolavp.approval.utils.FileSystemUtils fileSystemReadWriter)

This ctor is for testing only.

Methods

getApprovalPath

public static Path getApprovalPath(Path filePath)

Get the path for approval from the original file path.

Parameters:
  • filePath – the original path to value
Returns:

the path for approval

getConverter

Converter<T> getConverter()

getPathMapper

PathMapper<T> getPathMapper()

getReporter

Reporter getReporter()

of

public static <T> ApprovalBuilder<T> of(Class<T> clazz)

Create a new approval builder that will be able to approve objects from the specified class type.

Parameters:
  • clazz – the class object for the things you will be approving
  • <T> – the type of the objects you will be approving
Returns:

an approval builder that will be able to construct an Approval for your objects

verify

public void verify(T value, Path filePath)

Verify the value that was passed in.

Parameters:
  • value – the value object to be approved
  • filePath – the path where the value will be kept for further approval