While reading documentation about Dynamic Apex and Apex Describe, I found the definition of token which says:

Token — a lightweight, serializable reference to an sObject or a field that is validated at compile time. This is used for token describes.

What do both (1)lightweight and (2)serializable reference mean in this context?

From the documentation I can get some explanation for (1). But it just says why I would want to use lightweight tokens, and no word about what makes them lightweight

Because tokens are lightweight, using them can make your code faster and more efficient

1 Answer 1



A full field describe can require hundreds or thousands of bytes in heap, while the token only requires something like 4 bytes.


You can't serialize DescribeFieldResult directly in many cases (e.g. batchable), but the tokens will go through without a problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .