This is an automated email from the ASF dual-hosted git repository.
andreww pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git
The following commit(s) were added to refs/heads/master by this push:
new c1dbbfb Update reflection-introspection.md
c1dbbfb is described below
commit c1dbbfbab0917dc49985b375c3b487bb099fa0bc
Author: Andrew Wetmore <[email protected]>
AuthorDate: Mon Jan 3 18:40:46 2022 -0400
Update reflection-introspection.md
Minor text edits for readability.
---
features/reflection-introspection.md | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/features/reflection-introspection.md
b/features/reflection-introspection.md
index 57b1d91..4acd5ec 100644
--- a/features/reflection-introspection.md
+++ b/features/reflection-introspection.md
@@ -44,7 +44,7 @@ Royale supports class reflection and introspection using the
following functions
Use reflection to find the class of an object.
### registerClassAlias
-Sets up an alias mapping for serialization/deserialization purposes This can
be auto-generated by the Royale compiler when using class level metadata e.g.
[RemoteClass(alias='someAlias')]
+Sets up an alias mapping for serialization/deserialization purposes. The
Royale compiler can auto-generate this when using class level metadata, e.g.
[RemoteClass(alias='someAlias')]
```
registerClassAlias("someAlias", com.acme.Foo);
@@ -52,7 +52,7 @@ registerClassAlias("someAlias", com.acme.Foo);
### getAliasByClass
-Retrieves a an alias for a class, based on an alias mapping, previously
registered with registerClassAlias, or possibly using
[RemoteClass(alias='someAlias')] metadata.
+Retrieves an alias for a class, based on an alias mapping previously
registered with `registerClassAlias`, or possibly using
[RemoteClass(alias='someAlias')] metadata.
```
var alias:String = getAliasByClass(com.acme.Foo);
@@ -60,7 +60,7 @@ trace(alias); // Displays the alias name (i.e. someAlias)
```
### getClassByAlias
-Retrieves a class based on an alias mapping, previously registered with
registerClassAlias, or possibly using [RemoteClass(alias='someAlias')] metadata.
+Retrieves a class based on an alias mapping previously registered with
`registerClassAlias`, or possibly using [RemoteClass(alias='someAlias')]
metadata.
```
var classRef:Class = getClassByAlias("someAlias");
@@ -76,9 +76,9 @@ trace(ancestry.join(\n))// will output a list of the
inheritance tree
```
### getClosureQualifiedName
-Returns the qualified name of a closure instance. Using this to compare
against is recommended when checking for closures. It could insulate against
future changes or future variation between targets.
+Returns the qualified name of a closure instance. We recommend comparing
against this when checking for closures. It could insulate against future
changes or future variation between targets.
-(this is not generally used by an end user)
+(An app developer does not generally use this.)
```
trace(getClosureQualifiedName());// outputs "builtin.as$0.MethodClosure"
@@ -104,7 +104,7 @@ trace(className); // Displays flash.events::EventDispatcher
### getDefinitionByName
-If you have a class or function name, you can retrieve a reference to with
`getDefinitionByName()`. Provide a string parameter specifying a fully
qualified class or function name and the function and `getDefinitionByName()`
returns its Object type.
+If you have a class or function name, you can retrieve a reference to it with
`getDefinitionByName()`. Provide a string parameter specifying a fully
qualified class or function name and the function and `getDefinitionByName()`
returns its Object type.
If you’re retrieving a class reference, you can cast the return value to Class:
@@ -130,16 +130,17 @@ var instance:Object = new classReference();
### getDynamicFields
A utility method to check if an object is dynamic (i.e. can have non-sealed
members added or deleted).
-Note that static class objects are always dynamic, as are (static) Interface
Objects
+Note that static class objects are always dynamic, as are (static) Interface
Objects.
-The function takes four parameters:
+The function can take four parameters:
-1. The class or instance to check for dynamic fields
-2. A Function. An optional function for which takes a single String argument
and returns true to include that specific field in the results. If it returns
false, that property is excluded. Defaults to null, which applies no filtering
and returns all detected properties.
-3. A Boolean. An optional check to verify that the inspect parameter is
dynamic before inspecting it for dynamic properties. This should normally be
left at its default value of true. If it is known that the object is dynamic
before calling this method, setting this to false could improve performance in
performance-sensitive code. The results of calling this method on non-dynamic
objects may be less reliable or less consistent across target platforms if
checkFirst is false
-4. An Boolean. If true, numeric fields will be returned as numeric values
+1. The class or instance to check for dynamic fields.
+2. An optional function which takes a single String argument and returns
`true` to include that specific field in the results. If it returns `false`,
that property is excluded. Defaults to `null`, which applies no filtering and
returns all detected properties.
+3. An optional Boolean to verify that the inspect parameter is dynamic before
inspecting it for dynamic properties. This should normally be left at its
default value of `true`. If it is known that the object is dynamic before
calling this method, setting this to `false` could improve performance. The
results of calling this method on non-dynamic objects may be less reliable or
less consistent across target platforms if checkFirst is false.
+4. A Boolean. If `true`, numeric fields will be returned as numeric values.
It returns the dynamic fields as Strings in an Array.
+
### isDynamicObject
A utility method to check if an object is dynamic (can have non-sealed members
added or deleted).