Interface AgenticScopeJsonCodec
public interface AgenticScopeJsonCodec
A codec for serializing and deserializing
DefaultAgenticScope objects to and from JSON.-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanallowPackagePrefix(String packagePrefix) Allows every class under the given package prefix to be deserialized as part of anAgenticScope's state.default booleanAllows a single class to be deserialized as part of anAgenticScope's state.Deserializes a JSON string to aDefaultAgenticScopeobject.toJson(DefaultAgenticScope agenticScope) Serializes aDefaultAgenticScopeobject to a JSON string.default booleanwithClassLoader(ClassLoader classLoader) Sets theClassLoaderused to resolve the types named in a serializedAgenticScope, for applications whose domain types are not visible to the class loader that loaded LangChain4j.
-
Method Details
-
fromJson
Deserializes a JSON string to aDefaultAgenticScopeobject.- Parameters:
json- the JSON string.- Returns:
- the deserialized
DefaultAgenticScopeobject.
-
toJson
Serializes aDefaultAgenticScopeobject to a JSON string.- Parameters:
agenticScope- theDefaultAgenticScopeobject.- Returns:
- the serialized JSON string.
-
allowPackagePrefix
Allows every class under the given package prefix to be deserialized as part of anAgenticScope's state.Deserializing arbitrary types by name is how polymorphic deserialization becomes a vulnerability, so a codec that supports it keeps an allowlist. A codec that does not support allowlisting should return
falserather than silently accept everything.- Returns:
- whether this codec applied the registration.
-
allowType
Allows a single class to be deserialized as part of anAgenticScope's state.- Returns:
- whether this codec applied the registration.
- See Also:
-
withClassLoader
Sets theClassLoaderused to resolve the types named in a serializedAgenticScope, for applications whose domain types are not visible to the class loader that loaded LangChain4j.- Returns:
- whether this codec applied the class loader.
-