Spec-Zone.ru › ColdFusion

arrayGetMetadata

Gets metadata for items of an array and indicates the array type.

arrayGetMetadata(array) → returns struct

Member Function Syntax

someArray.getMetadata()

  • CF2016.0.2+
  • BL 1.0.0+
  • See Also: arraySetMetadata structGetMetadata structSetMetadata

    Argument Reference

    array array
    Required

    The array for which to get the metadata.

    Examples
    Sample code invoking the arrayGetMetadata function

    Simple Example

    // Create an array
    arrayList = ["apple", "pineapple", "mango"];
    
    // Fetch meta data
    data = arrayGetMetadata(arrayList);
    
    // Print array type
    writeOutput(data.type);

    Expected Result: synchronized

    Member Function Example

    // Create an array
    arrayList = ["apple", "pineapple", "mango"];
    
    // Fetch meta data
    data = arrayList.getMetadata();
    
    // Print array type
    writeOutput(data.type);

    Expected Result: synchronized

    Dump Metadata of Typed Array (Member syntax)

    CF 2018+ Return struct has a new key called dimensions and can also have a defined datatype. Supported datatypes are String, Numeric, Boolean, Date, Array, Struct, Query, Component, [Component name], Binary, and Function.

    arr = arrayNew['String'](1);
    writeOutput(serializeJson(arr.getMetadata()));

    Expected Result: {"dimensions":1,"datatype":"String","type":"synchronized"}

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/arraygetmetadata

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API