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

org.zodiac.script.context.ScriptEngineContextFactory Maven / Gradle / Ivy

package org.zodiac.script.context;

import org.zodiac.script.engine.ScriptEngineException;
import org.zodiac.sdk.toolkit.util.AssertUtil;
import org.zodiac.sdk.toolkit.util.ClassLoaderUtil;

public final class ScriptEngineContextFactory {

    private ScriptEngineContextFactory() {
    }

//    private static final Map CONTEXTS = CollAndMapUtil.concurrentMap();
//
//    static {
//        CONTEXTS.put("simple", new SimpleMapScriptEngineContext());
//    }

    public static ScriptEngineContext createSimpleEngineContext() {
        return createEngineContext(SimpleMapScriptEngineContext.class);
    }

    public static ScriptEngineContext createEngineContext(final Class clazz) {
        ScriptEngineContext engineContext = null;
        try {
            engineContext = (ScriptEngineContext)ClassLoaderUtil.newInstance(AssertUtil.notNull(clazz, "clazz"));
        } catch (Exception e) {
            throw new ScriptEngineException(e);
        }
        return engineContext;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy