Click or drag to resize

Telogis.GeoBase.Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Class Namespace

Contains functions for manipulating and validating managed GeoBase classes.

Functions
NameDescription
configure (Class Constructor, Array validList)

Registers a class as one with a configured constructor, and reads a list of valid configuration properties for that class. Once the class is thus registered, instances of it will be automatically checked for unrecognized configuration properties on construction.

Arguments
  • Constructor (Class) - The managed class to register as configured.

  • (Optional) validList (Array) - A list of names of valid configuration properties for the class. Each item in this list should be either a string or an array of alternative strings (all of which are registered as valid). Defaults to [].

create (Object instProps, Object staticProps)

Creates a new class by calling Class.extend without any base class.

Arguments
  • (Optional) instProps (Object) - The collection of properties and corresponding values to assign to each instance of the new class upon construction. Defaults to {}.

    Properties
    NameTypeDescription
    initFunction

    An optional constructor function to be called when a new instance of the class is created. If this is not specified, the base class constructor is used.

    Defaults to Base.init || function () {}.
  • (Optional) staticProps (Object) - The collection of static properties to assign to the new class constructor itself. Defaults to {}.

Returns

Class - The class described by the supplied properties.

createUnmanaged (Object instProps, Object staticProps)

Creates a new unmanaged class with the specified instance and static properties. Unmanaged classes lack the small construction overhead of managed ones, but cannot extend existing classes or be extended from.

Arguments
  • (Optional) instProps (Object) - The collection of properties and corresponding values to assign to each instance of the new class upon construction. Defaults to {}.

    Properties
    NameTypeDescription
    initFunction

    An optional constructor function to be called when a new instance of the class is created. If this is not specified, the base class constructor is used.

    Defaults to Base.init || function () {}.
  • (Optional) staticProps (Object) - The collection of static properties to assign to the new class constructor itself. Defaults to {}.

Returns

Class - The unmanaged class described by the supplied properties.

extend (Class Base, Object instProps, Object staticProps)

Creates a new class, and performs inheritance from a base class if specified. The resulting inheritance hierarchy is recorded in the static properties of each class.

Arguments
  • Base (Class) - The base class to inherit from.

  • (Optional) instProps (Object) - The collection of properties and corresponding values to assign to each instance of the new class upon construction. Defaults to {}.

    Properties
    NameTypeDescription
    initFunction

    An optional constructor function to be called when a new instance of the class is created. If this is not specified, the base class constructor is used.

    Defaults to Base.init || function () {}.
  • (Optional) staticProps (Object) - The collection of static properties to assign to the new class constructor itself. Defaults to {}.

Returns

Function - The class described by the specified properties and base class.

getDNClassDesc (Function jsClass)

Looks up a registered .NET class description by its JavaScript constructor function.

Arguments
  • jsClass (Function) - A reference to the constructor function for the JavaScript class to find a .NET class description for. Previously registered with Class.serializeAs. Returns an array whose first element is the name of the .NET server-side class, and whose second element is the name of the .NET DLL in which it is defined.

Returns

Array - An array whose first element is the name of the .NET server-side class, and whose second element is the name of the .NET DLL in which it is defined.

getDNPropName (Class Constructor, String jsName)

Looks up the property name for a .NET class that corresponds to a named property on its JavaScript equivalent. This relationship should have been previously recorded with a call to Class.serializeWith if the property names differ.

Arguments
  • Constructor (Class) - A reference to the constructor for the JavaScript class that the given property name is for.

  • jsName (String) - The JavaScript property name to find the .NET equivalent for.

Returns

String - The .NET property name associated with Class.getDNPropName.jsName.

getInstantiator (Class Class)

Gets the method used to instantiate the specified class during JSON deserialization.

Arguments
  • Class (Class) - The class to get the instantiator method for.

Returns

Function - A function to be executed when the class is deserialized from a string of JSON text, used to initialize the members of a newly-created instance from the field values read from the JSON. This will be executed in the scope of the object being instantiated.

getJSClass (Array dnClassDesc)

Looks up a registered JavaScript constructor from a description of its .NET analogue.

Arguments
  • dnClassDesc (Array) - An array whose first element is the name of the .NET server-side class, and whose second element is the name of the DLL in which it is defined.

Returns

Function - The associated Javascript constructor, or null if none is present.

getJSPropName (Class Constructor, String dnName)

Looks up the property name for a JavaScript class that corresponds to a named property on its .NET equivalent. This relationship should have been previously recorded with a call to Class.serializeWith if the property names differ.

Arguments
  • Constructor (Class) - A reference to the constructor for the JavaScript class to find a property name for.

  • dnName (String) - The .NET property name to find the JavaScript equivalent for.

Returns

String - The JavaScript property name associated with Class.getJSPropName.dnName.

isConfigured (Class Class)

Determines whether a class has a configured constructor -- that is, one that takes a configuration object as an argument.

Arguments
  • Class (Class) - The class to test.

Returns

Boolean - True if Class.isConfigured.Class is configured; false otherwise.

isSerializable (Class Class, String propName)

Determines whether a JavaScript class or instance property can be serialized in a call to Internal.JSON.serialize.

Arguments
  • Class (Class) - The class to check the serializability of, or the class to which the target property pertains.

  • (Optional) propName (String) - The name of the property of Class.isSerializable to check the serializability of. If this is not specified, the serializability of the class itself is tested. Defaults to null.

serializeAs (Function jsClass, String dnName, String dnAssembly)

Registers a JavaScript class as serializable by recording an association with a .NET class name and assembly.

Arguments
  • jsClass (Function) - A reference to the constructor function for the Javascript class to associate with a .NET class description.

  • dnName (String) - The name of the .NET class to associate with Class.serializeAs.Class. If a .NET assembly is explicitly specified, this is assumed to be fully-qualified and no namespace is added. Otherwise, it is prefixed with 'Telogis.GeoBase.'.

  • (Optional) dnAssembly (String) - The name of the .NET DLL in which the server-side class is defined. Defaults to geobase.net.

serializeWith (Class Class, Array aliasTable)

Records a list of property name aliases from the client-side JavaScript class to its server-side .NET analogue. These are used to override the names of serialized properties for server communications involving the calling class. Note that the class this is called for need not be a managed class.

Arguments
  • Class (Class) - The class to record property aliases for.

  • aliasTable (Array) - A list of property name aliases to record. Each element of this array should be an array containing two elements: the name of the JavaScript property, and its corresponding .NET name.

serializeWithout (Class Class, Array ignoreList)

Registers a list of property names that will not be serialized with the specified class when an instance of it is passed to Internal.JSON.serialize.

Arguments
  • Class (Class) - A reference to the class to specify properties to ignore in serialization for.

  • ignoreList (Array) - A list of property-name strings describing the instance properties of Class.serializeWithout.Class that should not be serialized.

setInstantiator (Class Class, Function method)

Sets the method used to instantiate the specified class during JSON deserialization.

Arguments
  • Class (Class) - The class to specify an instantiator method for.

  • method (Function) - A function to be executed when the class is deserialized from a string of JSON text, used to initialize the members of a newly-created instance from the field values read from the JSON. This will be executed in the scope of the object being instantiated.

    Arguments
    • fields (Object) - The uninstantiated object deserialized from the JSON. This will contain appropriately-valued properties with the same names as those belonging to the target class; however, it has not been constructed with the class's constructor and any calculated content will therefore be unavailable.

virtualize (Class Class, String virtualList)

Associates a list of virtual methods with a class, so that when this class is extended, the virtual methods must be implemented. If they are not, a warning is given.

Arguments
  • Class (Class) - The class to register virtual methods for.

  • virtualList (String) - A list of names of virtual methods for the class.