-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogic.java
More file actions
33 lines (31 loc) · 1.25 KB
/
Logic.java
File metadata and controls
33 lines (31 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Logic.java
* Copyright (C) 2022-2026 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;
import com.github.sttk.errs.Err;
/**
* Represents the application's business logic, designed to separate data access concerns from the
* core logic.
*
* <p>Implementations of this functional interface should focus solely on the business logic,
* utilizing the provided {@code data} object of type {@code D} for all data access operations. The
* {@link #run(Object)} method should not contain any direct data access code; instead, it should
* delegate such operations to methods of the {@code D} object.
*
* <p>If an exceptional condition occurs during the execution of the logic, an {@link Err} object
* should be thrown.
*
* @param <D> The type of the data access object through which data operations are performed.
*/
@FunctionalInterface
public interface Logic<D> {
/**
* Executes the application's business logic. This method should implement the core logic, relying
* on the {@code data} object for all data access needs.
*
* @param data The data access object, providing methods for interacting with data.
* @throws Err if an error or exceptional condition occurs during the logic execution.
*/
void run(D data) throws Err;
}