feat(muscript): support custom dynamic implementations via DynamicBase
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2023-08-14 15:53:18 +02:00
parent b91e15e352
commit 935d6f9cf6
Signed by: Johannes
GPG Key ID: E76429612C2929F4
3 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,7 @@ import java.io.IOException;
* Override toString(StringBuilder) to support custom serialization (note: the serialized form is ran with muScript to generate the tree)
* @param <T> the type represented
*/
public sealed interface Dynamic<T> permits DBool, DNumber, DString, DObject, DList, DCallable, DNull, DContainer {
public sealed interface Dynamic<T> permits DBool, DCallable, DList, DNull, DNumber, DObject, DString, DynamicBase {
/**
* Deserialize simply dynamic values. DOES NOT SUPPORT CALLABLES!
* Use Parser.parse() if you truly need to deserialize them, but be aware that that might enable DOS attacks

View File

@ -0,0 +1,9 @@
package io.gitlab.jfronny.muscript.data.dynamic;
/**
* Use this for ABSTRACT (!) implementations of custom dynamic containers.
* Any concrete implementation MUST still implement a valid Dynamic subtype (DBool, DString, ...)
* @param <T> the type represented
*/
public non-sealed interface DynamicBase<T> extends Dynamic<T> {
}

View File

@ -1,8 +1,9 @@
package io.gitlab.jfronny.muscript.data.dynamic.additional;
import io.gitlab.jfronny.muscript.data.dynamic.Dynamic;
import io.gitlab.jfronny.muscript.data.dynamic.DynamicBase;
public abstract non-sealed class DContainer<T> implements Dynamic<T> {
public abstract class DContainer<T> implements DynamicBase<T> {
private T value;
@Override