Skip to content

Releases: cesarParra/apex-reflection

v2.7.0

17 Feb 14:56
7e31c39
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.0.0...v2.7.0

v2.0.0

08 Dec 21:36
f1c05a9
Compare
Choose a tag to compare

Update to improve the way type references are parsed.

Previously types were represented as a string property on field members (properties and variables) as well as method return types so, for instance, a variable declaration that looks as follows

public String myVariable;

would have a type of String. The problem is that collection variables were also treated the same way, so something like

public List<String> myVariable;
public Map<String, List<String>> myVariable;

would also be represented as a string, without it being easy to understand what the collection was composed of without further parsing, using Regex or parsing the string itself.

Now, types are represented to the typeReference variable, which gives better insight around collections.

For lists, string and arrays, the typeReference has an inner ofType property, which is also in turn a Type Reference itself, so the reference is recursive when dealing with collections of multiple levels.

For maps, the typeReference has a keyType, which is in turn a type Reference for the key, and a valueType which is a Type Reference for the value, again allowing for recursive references inside of references.


Because the type has been removed from the models in favor of typeReference, this represents a breaking change, and thus the major version release.

If upgrading and not looking to make use of the new Type Reference object, each typeReference also has a rawDeclaration string property, which holds the exact same value that type used to hold, so the only necessary step is to upgrade any references to type and instead now reference typeReference.rawDeclaration