Record Class Dynamic<T>
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.common.serialization.Dynamic<T>
- Type Parameters:
T- the serialized value type
A wrapper around a serialized value and its associated
DynamicOps
implementation.
This class provides a fluent API for querying, modifying, and converting dynamic data structures without repeatedly passing the operations instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> Dynamic<R> convert(DynamicOps<R> outOps) Converts the wrapped value to a different serialized format.Applies a transformation to the value located at the specified path.final booleanIndicates whether some other object is "equal to" this one.Retrieves a nested value using a compiled path.Retrieves a nested value using a path expression.final inthashCode()Returns a hash code value for this object.ops()Returns the operations implementation associated with this value.Removes the value located at the specified path.Sets a value at the specified path using another dynamic wrapper.Sets a value at the specified path.final StringtoString()Returns a string representation of this record class.value()Returns the wrapped serialized value.
-
Constructor Details
-
Dynamic
Creates a new dynamic wrapper.- Parameters:
ops- the operations implementation associated with the valuevalue- the wrapped serialized value
-
-
Method Details
-
ops
Returns the operations implementation associated with this value.- Returns:
- the operations implementation
-
value
Returns the wrapped serialized value.- Returns:
- the wrapped value
-
get
Retrieves a nested value using a path expression.- Parameters:
path- the path expression to resolve- Returns:
- the nested value wrapped as a
Dynamic, if present
-
get
Retrieves a nested value using a compiled path.- Parameters:
path- the compiled path to resolve- Returns:
- the nested value wrapped as a
Dynamic, if present
-
set
Sets a value at the specified path.- Parameters:
path- the destination pathvalue- the value to store- Returns:
- a new dynamic instance containing the updated structure
-
set
Sets a value at the specified path using another dynamic wrapper.- Parameters:
path- the destination pathdynamic- the dynamic containing the value to store- Returns:
- a new dynamic instance containing the updated structure
-
edit
Applies a transformation to the value located at the specified path.- Parameters:
path- the target patheditor- the function used to transform the value- Returns:
- a new dynamic instance containing the updated structure
-
remove
Removes the value located at the specified path.- Parameters:
path- the path of the value to remove- Returns:
- a new dynamic instance containing the updated structure
-
convert
Converts the wrapped value to a different serialized format.- Type Parameters:
R- the target serialized value type- Parameters:
outOps- the target operations implementation- Returns:
- a dynamic wrapper containing the converted value
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-