inspect#

inspect(java)[source]#

Inspects a Java node object.

This is a convenience function to facilitate exploring Comsol’s Java API in an interactive Python session. It expects a Java node object, such as the one returned by the .java property of an existing node reference, which would implement the com.comsol.model.ModelEntity interface.

Like any object, it could also be inspected with Python’s built-in dir command. This function here outputs a “pretty-fied” version of that. It displays (prints to the console) the methods implemented by the Java node as well as its properties, if any are defined.

>>> mph.inspect((model/'studies').java)
name:    StudyList
tag:     study
display: StudyList
doc:     StudyList
methods:
  clear
  copy
  copyTo
  create
  duplicate
  duplicateTo
  equals
  forEach
  get
  getContainer
  index
  iterator
  model
  move
  remove
  scope
  size
  spliterator
  tags
  uniquetag

The node’s name, tag, and documentation reference marker are listed first. These access methods and a few others, which are common to all objects, are suppressed in the method list further down, for the sake of clarity.