TIBET Logo

tibet-reflect(1) -- reflects on TIBET objects and methods

SYNOPSIS

tibet reflect [target] [--interface <interface>] [--filter <filter>] [--types] [--methods] [--owners] [--slots]

DESCRIPTION

Runs the TSH :reflect command to show object or system reflection data.

You can list all of TIBET's types via tibet reflect --types or list all methods via tibet reflect --methods. Without a target object this approach lets you view the top-most metadata collections in TIBET.

The [target] parameter can be any object reference TIBET can resolve using TIBET's getObjectById() function. That means any namespace, type, method, or publicly registed object such as window or a TIBET URI.

For objects which support it the --interface option lets you restrict the results to a specific interface of the object. The values here must be found in the TP.SLOT_FILTERS object as used by TP.interface(). Some interesting options are known, public, and unique.

Note that not all flags will work for every target object type. Namespace objects don't support --owners for example. When a flag is ignored it is not typically reported since working combinations are so target-dependant. The best thing to do is experiment a little and see what reflect finds.

The --filter option allows you to refine your result data by checking the keys returned against either a regular expression or string. The filter value is always used as a RegExp if one can be created from the string. Full RegExp syntax is possible to the extent your shell will allow it. For example, using --filter '/example/i' will filter for example in a case-insensitive fashion.

OPTIONS

  • target : An optional target, usually a type name, to check.

  • --filter : An optional regular expression, expressed in /foo/ig form. This filter will be applied to fully-qualified method names.

  • --interface : An interface value from the TP.SLOT_FILTERS list in TIBET.

  • --methods : Signify that the search should work against methods. This can list all methods (or a subset by combining with --filter) or just the methods of a particular target.

  • --owners : Signify the search should produce owners. This flag is primarily useful only when reflecting on a function. In that case it should return a list of the owners (implementers) of the function. You can also use this flag alone to list all known owners of methods in the system.

  • --slots : Focus the search on attributes if no other flags are provided. Otherwise focus on all keys on the target object, not just methods etc.

  • --types : Normally used to list all types, or to filter types in conjunction with the --filter option.

EXAMPLES

List all types in the system

$ tibet reflect --types

Loading TIBET via PhantomJS 2.1.1 at June 30, 2016 at 15:14:36 MDT
TIBET loaded in 3867 ms. Starting execution.

APP.hello.Application
APP.hello.app
Array
ArrayBuffer
ArrayBufferView
Attr
...
...
XPathException
XPathExpression
XPathResult
XSLTProcessor

List all types in the APP namespace

$ tibet reflect --types --filter /APP/

Loading TIBET via PhantomJS 2.1.1 at June 30, 2016 at 15:14:36 MDT
TIBET loaded in 3867 ms. Starting execution.

APP.hello.Application
APP.hello.app

Finished in 3762 ms w/TSH exec time of 201 ms.

List all methods in the system

$ tibet reflect --methods

Loading TIBET via PhantomJS 2.1.1 at June 30, 2016 at 15:14:36 MDT
TIBET loaded in 3632 ms. Starting execution.

APP.hello.Application.Inst.handleAppDidInitializeFromANYWhenANY
Array.Inst.$$isCollection
Array.Inst.$$isMemberOf
Array.Inst.$$isPair
Array.Inst.$get
Array.Inst.$getEqualityValue
Array.Inst.$set
Array.Inst.$sortIfNeeded
Array.Inst.add
Array.Inst.addAfter
Array.Inst.addAll
Array.Inst.addAllAfter
...
...
Window.Inst.getTypeName
Window.Inst.setID
Window.Type.getName

List all methods that include 'element' in their names

$ tibet reflect --methods --filter /element/i

Loading TIBET via PhantomJS 2.1.1 at June 30, 2016 at 15:13:25 MDT
TIBET loaded in 3597 ms. Starting execution.

TP.$$elementPreserveIFrameContent
TP.$$elementRestoreIFrameContent
TP.$elementCSSFlush
TP.$elementGetBusyLayer
TP.$elementGetOffsetParent
...
...
TP.xctrls.SwitchableElement.Inst.setDisplayValue
TP.xctrls.SwitchableElement.Inst.setValue
TP.xmpp.Error.Inst.getErrorElement
TP.xmpp.Node.Inst.getErrorElement
TP.xs.XMLSchemaComplexCompositeType.Type.validateElements

List all methods For a specific target

$ tibet reflect --methods TP.log.Manager.Type

Loading TIBET via PhantomJS 2.1.1 at June 30, 2016 at 15:11:37 MDT
TIBET loaded in 3560 ms. Starting execution.

exists
getLogger
getLoggerFactory
getLoggers
getRootLogger
initialize
registerLogger
removeLogger

Finished in 3630 ms w/TSH exec time of 70 ms.

View reflection data for a specific method

$ tibet reflect TP.log.Manager.Type.getLoggers

Loading TIBET via PhantomJS 2.1.1 at July 1, 2016 at 20:23:46 MDT
TIBET loaded in 3783 ms. Starting execution.

TP.log.Manager.Type.getLoggers

/**
 * @method getLoggers
 * @summary Returns the dictionary of all known loggers. The keys of this
 *     dictionary are the logger names converted to lowercase to normalize
 *     them. The entries are the logger instances themselves.
 * @returns {TP.core.Hash} The logger dictionary.
 */

~lib_src/tibet/kernel/TIBETLogging.js

View reflection data for a TIBET Primitive

$ tibet reflect json2xml

Loading TIBET via PhantomJS 2.1.1 at July 1, 2016 at 20:25:29 MDT
TIBET loaded in 3701 ms. Starting execution.

TP.json2xml

/**
 * @method json2xml
 * @summary Transforms a JSON-formatted string into roughly equivalent XML.
 * @description The transformation is in two steps, first to JS and then
 *     into simple XML where keys are element names and values are content
 *     text nodes.
 * @param {String} aString A JSON-formatted string.
 * @returns {Node} An XML node representing the same data structures found
 *     in the JSON string.
 */

~lib_src/tibet/kernel/TIBETContentPrimitives.js

TROUBLESHOOTING

You may need to escape certain values for your shell

$ tibet reflect TP.boot.$uitime

Loading TIBET via PhantomJS 2.1.1 at July 1, 2016 at 22:09:04 MDT
TIBET loaded in 4236 ms. Starting execution.

TP.boot. not found.

Finished in 4304 ms w/TSH exec time of 68 ms.

$ tibet reflect 'TP.boot.$uitime'

Loading TIBET via PhantomJS 2.1.1 at July 1, 2016 at 22:09:21 MDT
TIBET loaded in 3779 ms. Starting execution.

"2016-07-02T04:09:25.148Z"

SEE ALSO

  • tibet-apropos(1)
  • tibet-help(1)