Package sc.lang.java

Class ModelStream

  • All Implemented Interfaces:
    ISemanticNode, ICustomResolver, ILifecycle

    public class ModelStream
    extends SemanticNode
    implements ICustomResolver
    Stores a stream of changes that need to be made to a model. This object is used both for synchronization and for updating an application when the source code changes. It's the main data structure that stores info used in a sync update to/from the client. When the serialization format is 'stratacode', you can create the model stream by parsing the input using the ModelStream parselet in the JavaLanguage. Or a model stream can be created in the code from UpdateInstanceInfo - when changes are detected after the source code is refreshed (in this case, it represents the changes to the code since the source was last refreshed). The model stream can also be created from other serialization formats like JSON.
    • Constructor Detail

      • ModelStream

        public ModelStream()
      • ModelStream

        public ModelStream​(boolean isSyncStream)
    • Method Detail

      • convertToJS

        public java.lang.StringBuilder convertToJS​(java.lang.String destName,
                                                   java.lang.String defaultScope)
      • updateRuntime

        public void updateRuntime​(java.lang.String destName,
                                  java.lang.String defaultScope,
                                  boolean applyRemoteReset)
        This is called to apply the model stream to the system using the supplied default scope.
      • setLayeredSystem

        public void setLayeredSystem​(LayeredSystem sys)
      • resolveType

        public java.lang.Object resolveType​(java.lang.String currentPackage,
                                            java.lang.String typeName,
                                            boolean create,
                                            TypeDeclaration fromType)
        Returns the type of the object with the given name - for compile time checks
        Specified by:
        resolveType in interface ICustomResolver
      • resolveObject

        public java.lang.Object resolveObject​(java.lang.String currentPackage,
                                              java.lang.String name,
                                              boolean create,
                                              boolean unwrap)
        Returns the object instance with the given name - for runtime lookup.
        Specified by:
        resolveObject in interface ICustomResolver
      • resolveFieldWithName

        public VariableDefinition resolveFieldWithName​(java.lang.String pkgName,
                                                       java.lang.String typeName)
      • useRuntimeResolution

        public boolean useRuntimeResolution()
        Return true for the sync system to look up .class files only. We only use this optimization when all of the classes are compiled.
        Specified by:
        useRuntimeResolution in interface ICustomResolver
      • addModel

        public void addModel​(JavaModel model)
      • convertToModelStream

        public static ModelStream convertToModelStream​(java.lang.String layerDef,
                                                       BindingContext bindCtx)