Class DefaultExternalValueFactory

  • All Implemented Interfaces:
    IExternalValueFactory

    public class DefaultExternalValueFactory
    extends java.lang.Object
    implements IExternalValueFactory
    Default interpreter factory with framework support and other basic features. This class provides run-time support only. It creates and destroys certain types based on load and unload
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String DATA_WRITER_TYPE_NAME  
      protected java.util.HashMap<java.lang.String,​java.util.function.Function<java.util.List<Value>,​com.spencerwi.either.Either<java.lang.Exception,​Value>>> instantiators  
      protected java.lang.String MATH_TYPE_NAME  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.spencerwi.either.Either<java.lang.Exception,​Value> create​(java.lang.String type, java.util.List<Value> args)
      Creates a new interpreter value for the specified type using the supplied arguments
      Value destroy​(Value value)
      Destruction of values created by the factory.
      boolean supports​(java.lang.String type)
      Check if a certain type is supported by the external value factory
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DATA_WRITER_TYPE_NAME

        protected final java.lang.String DATA_WRITER_TYPE_NAME
        See Also:
        Constant Field Values
      • instantiators

        protected java.util.HashMap<java.lang.String,​java.util.function.Function<java.util.List<Value>,​com.spencerwi.either.Either<java.lang.Exception,​Value>>> instantiators
    • Constructor Detail

      • DefaultExternalValueFactory

        public DefaultExternalValueFactory()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • DefaultExternalValueFactory

        public DefaultExternalValueFactory​(java.io.File workingDirectory,
                                           java.io.InputStream config)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • create

        public com.spencerwi.either.Either<java.lang.Exception,​Value> create​(java.lang.String type,
                                                                                   java.util.List<Value> args)
        Description copied from interface: IExternalValueFactory
        Creates a new interpreter value for the specified type using the supplied arguments
        Specified by:
        create in interface IExternalValueFactory
        Parameters:
        type - the type to create
        args - the arguments used to create the value
        Returns:
        the value or an exception if creation fails
      • destroy

        public Value destroy​(Value value)
        Description copied from interface: IExternalValueFactory
        Destruction of values created by the factory. Destruction must make sure all resources hold by this value is freed
        Specified by:
        destroy in interface IExternalValueFactory
        Parameters:
        value - the value to destroy
        Returns:
        void return