@haxall/haxall
    Preparing search index...

    Class MNamespace

    LibNamespace implementation base class

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    type$: Type

    Methods

    • Parameters

      Returns void

    • Parameters

      • it: NameTable

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void

    • Return base namespace if this namespace is an overlay.

      Returns MNamespace

    • Return choice API for given spec. Callers should prefer the slot over the type since the slot determines maybe and multi-choice flags. Raise exception if Spec.isChoice is false.

      Parameters

      Returns SpecChoice

    • Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:

      this < that   =>  <0
      this == that => 0
      this > that => >0

      This method may also be accessed via the < <= <=> >= and > shortcut operators. If not overridden the default implementation compares the toStr representations. Also see docLang.

      Examples:

      3.compare(8)  =>  -1
      8.compare(3) => 1
      8.compare(8) => 0
      3 <=> 8 => -1 // shortcut for 3.compare(8)

      Parameters

      Returns number

    • Compile a Xeto data file into an in-memory value. All dependencies are resolved against this namespace. Raise exception if there are any syntax or semantic errors. If the file contains a scalar value or one dict, then it is returned as the value. If the file contains two or more dicts then return a Dict[] of the instances.

      Options

      • externRefs: marker to allow unresolved refs to compile

      Parameters

      • src: string
      • Optionalopts: Dict

      Returns JsObj

    • Convenience for compileData but always returns data as list of dicts. If the data is not a Dict nor list of Dicts, then raise an exception.

      Parameters

      • src: string
      • Optionalopts: Dict

      Returns List<Dict>

    • Compile Xeto source code into a temp library. All dependencies are resolved against this namespace. Raise exception if there are any syntax or semantic errors.

      Parameters

      • src: string
      • Optionalopts: Dict

      Returns Lib

    • Base64 digest for this namespace based on its lib versions

      Returns string

    • Load a list of versions asynchronously and return result of either a XetoLib or Err (is error on server)

      Parameters

      Returns void

    • Load given version synchronously. If the libary can not be loaed then raise exception to the caller of this method.

      Parameters

      Returns XetoLib

    • Parameters

      Returns void

    • Iterate all the instances in libs In remote namespace this only iterates loaded libs.

      Parameters

      • f: (arg0: Dict) => void

      Returns void

    • Parameters

      Returns void

    • Parameters

      • f: (arg0: Lib) => void

      Returns void

    • Iterate each subtype of given type that returns true for isa(type)

      Parameters

      Returns void

    • Iterate all the top-level types in libs. In remote namespace this only iterates loaded libs.

      Parameters

      • f: (arg0: Spec) => void

      Returns void

    • Compare this object to the specified for equality. This method may be accessed via the == and != shortcut operators. If not overridden the default implementation compares for reference equality using the === operator. If this method is overridden, then hash() must also be overridden such that any two objects which return true for equals() must return the same value for hash(). This method must accept null and return false.

      Parameters

      Returns boolean

    • Return if the given instance fits the spec via structural typing. Options:

      • graph: marker to also check graph of references such as required points
      • ignoreRefs: marker to ignore if refs resolve to valid target
      • haystack: marker tag to use Haystack level data fidelity

      Parameters

      Returns boolean

    • Parameters

      • name: string
      • Optionalchecked: boolean

      Returns Spec

    • Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.

      Returns number

    • Return if this namespace contains the given lib name. This is true if version will return non-null regardless of libStatus.

      Parameters

      • name: string

      Returns boolean

    • Get or load instance by the given qualified name See lib() for behavior if the instances's lib is not loaded.

      Parameters

      • qname: string
      • Optionalchecked: boolean

      Returns Dict

    • Create default instance for the given spec. Raise exception if spec is abstract.

      Options:

      • graph: marker tag to instantiate graph of recs (will auto-generate ids)
      • abstract: marker to supress error if spec is abstract
      • id: Ref tag to include in new instance
      • haystack: marker tag to use Haystack level data fidelity

      Parameters

      Returns JsObj

    • Return true if the every library in this namespace has been loaded (successfully or unsuccessfully). This method returns false is any libs have a load status of notLoaded. Many operations require a namespace to be fully loaded.

      Returns boolean

    • Return if this Obj is immutable and safe to share between threads:

      • an instance of a const class
      • the result of toImmutable on List, Map, or Buf
      • a Func object may or may not be immutable - see sys::Func.
      • other instances are assumed mutable and return false

      Returns boolean

    • Return true if this an overlay namespace overlaid on base.

      Returns boolean

    • Get the given library by name synchronously. If this is a Java environment, then the library will be compiled on its first access. If the library cannot be compiled then an exception is always raised regardless of checked flag. If this is a JS environment then the library must already have been loaded, otherwise raise exception if checked is true. Use libAsync to load a library in JS environment.

      Parameters

      • name: string
      • Optionalchecked: boolean

      Returns Lib

    • Get or load library asynchronously by the given dotted name. This method automatically also loads the dependency chain. Once loaded then invoke callback with library or err.

      Parameters

      • name: string
      • f: (arg0: Err, arg1: Lib) => void

      Returns void

    • Exception for a library with lib status of err, or null otherwise. Raise exception is library not included in this namespace.

      Parameters

      • name: string

      Returns Err

    • Get or load list of libraries asynchronously by the given dotted names. This method automatically also loads the dependency chain. Once loaded then invoke callback with libraries or err. If a lib cannot be loaded then it is excluded from the callback list (so its possible the results list is not the same size as the names list).

      Parameters

      Returns void

    • List all libraries. On first call, this will force all libraries to be loaded synchronously. Any libs which cannot be compiled will log an error and be excluded from this list. If isAllLoaded is true then this call can also be in JS environments, otherwise you must use the libsAllAsync call to fully load all libraries into memory.

      Returns List<Lib>

    • Load all libraries asynchronosly. Once this operation completes successfully the isAllLoaded method will return true and the libs method may be used even in JS environments. Note that an error is reported only if the entire load failed. Individual libs which cannot be loaded will logged on server, and be excluded from the final libs list.

      Parameters

      Returns void

    • Return load status for the given library name:

      • notLoaded: library is included but has not been loaded yet
      • ok: library is included and loaded successfully
      • err: library is included but could not be loaded
      • null/exception if library not included

      Parameters

      • name: string
      • Optionalchecked: boolean

      Returns LibStatus

    • Returns NameTable

    • Parameters

      Returns void

    • Get or load spec by the given qualified name:

      • type: "foo.bar::Baz"
      • global: "foo.bar::baz"
      • slot: "foo.bar::Baz.qux" See lib() for behavior if the spec's lib is not loaded.

      Parameters

      • qname: string
      • Optionalchecked: boolean

      Returns XetoSpec

    • Parameters

      Returns boolean

    • Spec for Fantom sys::Type or the typeof given object

      Parameters

      • val: JsObj
      • Optionalchecked: boolean

      Returns Spec

    • Returns MSys

    • Returns Lib

    • Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:

      • if type is const, return this
      • if already an immutable List, Map, Buf, or Func return this
      • if a List, then attempt to perform a deep clone by calling toImmutable on all items
      • if a Map, then attempt to perform a deep clone by calling toImmutable on all values (keys are already immutable)
      • some Funcs can be made immutable - see sys::Func
      • if a Buf create immutable copy, see sys::Buf
      • any other object throws NotImmutableErr

      Returns Readonly<this>

    • Return a string representation of this object.

      Returns string

    • Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:

      a->x        a.trap("x", null)
      a->x() a.trap("x", null)
      a->x = b a.trap("x", [b])
      a->x(b) a.trap("x", [b])
      a->x(b, c) a.trap("x", [b, c])

      The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.

      Parameters

      Returns JsObj

    • Get or load type by the given qualified name. If the type's lib is not loaded, it is loaded synchronously.

      Parameters

      • qname: string
      • Optionalchecked: boolean

      Returns XetoSpec

    • Get the Type instance which represents this object's class. Also seeType.of or Pod.of.

      Returns Type

    • Parameters

      • name: string
      • Optionalchecked: boolean

      Returns Spec

    • Lookup the version info for a library name in this namespace.

      Parameters

      • name: string
      • Optionalchecked: boolean

      Returns LibVersion

    • This method called whenever an it-block is applied to an object. The default implementation calls the function with this, and then returns this.

      Parameters

      • f: (arg0: this) => void

      Returns this

    • Write instance data in Xeto text format to an output stream. If the value is a Dict[], then it is flattened in the output. Use compileData to read data from Xeto text format.

      Parameters

      Returns void

    • Lookup the extended meta for the given spec qname. This is a merge of the spec's own meta along with any instance dicts in the namespace with a local id of "xmeta-{lib}-{spec}". Only libs currently loaded are considered for the result. If the spec is not defined then return null or raise an exception based on checked flag. For example to register extended meta data on the ph::Site spec you would create an instance dict with the local name of xmeta-ph-Site.

      Parameters

      • qname: string
      • Optionalchecked: boolean

      Returns Dict

    • Lookup the extended meta for an enum spec. This returns a SpecEnum instance with resolved extended meta for all the enum items via a merge of all libs with instances named "xmeta-{lib}-{spec}-enum".

      Parameters

      • qname: string
      • Optionalchecked: boolean

      Returns SpecEnum

    • Write x.toStr to standard output followed by newline. If x is null then print "null". If no argument is provided then print an empty line.

      Parameters

      Returns void