All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.plugin.js.JSExternal Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.plugin.js;

import lombok.Data;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;

@Data
public abstract class JSExternal {
    protected final Context sourceContext;
    protected final Value value;
    private boolean alive = true;

    protected final void checkAlive() {
        if(!alive) {
            throw new ReferenceNotAliveException("Reference targeting " + value.getMetaQualifiedName() + " has already be disposed.");
        }
    }

    public static final class ReferenceNotAliveException extends RuntimeException {
        public ReferenceNotAliveException(String message) {
            super(message);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy