-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(NodeOutput): remove lombok @value and remove final class con…
…straint work on #24
- Loading branch information
1 parent
40fad25
commit 41a095e
Showing
1 changed file
with
35 additions
and
6 deletions.
There are no files selected for viewing
41 changes: 35 additions & 6 deletions
41
core-jdk8/src/main/java/org/bsc/langgraph4j/NodeOutput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,54 @@ | ||
package org.bsc.langgraph4j; | ||
|
||
import lombok.Value; | ||
import lombok.experimental.Accessors; | ||
import org.bsc.langgraph4j.state.AgentState; | ||
|
||
import static java.lang.String.format; | ||
|
||
/** | ||
* Represents the output of a node in a graph. | ||
* | ||
* @param <State> the type of the state associated with the node output | ||
*/ | ||
@Value(staticConstructor="of") | ||
@Accessors(fluent = true) | ||
public class NodeOutput<State extends AgentState> { | ||
|
||
public static <State extends AgentState> NodeOutput<State> of( String node, State state ) { | ||
return new NodeOutput<>(node, state); | ||
} | ||
|
||
/** | ||
* The identifier of the node. | ||
*/ | ||
String node; | ||
private final String node; | ||
|
||
/** | ||
* The state associated with the node. | ||
*/ | ||
State state; | ||
private final State state; | ||
|
||
public String node() { | ||
return node; | ||
} | ||
|
||
public State state() { | ||
return state; | ||
} | ||
|
||
/** | ||
* @deprecated Use {@link #state()} instead. | ||
*/ | ||
@Deprecated | ||
public State getState( ) { | ||
return state(); | ||
} | ||
|
||
protected NodeOutput( String node, State state ) { | ||
this.node = node; | ||
this.state = state; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return format("NodeOutput{node=%s, state=%s}", node(), state()); | ||
} | ||
|
||
} |