VMware Cloud Community
StefanSchnell
Enthusiast
Enthusiast

Tip: Get all Properties of the SDKType Object

Since a few days I am dealing with the basics of prototype-based programming. In this context I have implemented a small routine that, when called with the argument this, returns all properties of the object SDKType.

// Begin ---------------------------------------------------------------

/*
 * Delivers all properties of the SDKType object.
 *
 * @AUTHOR Stefan Schnell
 *
 * Checked with vRA 8.5.1.18666
 *
 */

function getAllProperties(object) {

  /*
   * Prints all properties (including non-enumerable properties, except
   * for those which use Symbol) found directly in the given object, as
   * an array of strings.
   */

  var allProperties = Object.getOwnPropertyNames(object).sort();

  System.log(allProperties.length + " properties of " + object.toString());

  var output = "\n[\n";
  for (var i = 0; i < allProperties.length; i++) {
    if (i < allProperties.length - 1) {
      output += "  \"" + allProperties[i] + "\",\n";
    } else {
      output += "  \"" + allProperties[i] + "\"\n";
    }
  }
  output += "]";

  System.log(output);

}

getAllProperties(Object.getPrototypeOf(this));

// End -----------------------------------------------------------------

allSDKTypeProperties.jpg

On this way, for example, we get 4308 properties in the HOL with the Aria Automation Release 8.5.1. And as we can see, this approach also delivers the objects that are made available via the plugins.

allSDKTypeProperties002.jpg

Perhaps this is an interesting basis for further analysis.


More interesting information at blog.stschnell.de

Labels (2)
Reply
0 Kudos
0 Replies