Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Question about requestHandlers map in AsyncRequestQueueable #4

@skostojohn

Description

@skostojohn

I have a question about this map, which uses the handler class names as keys and the Type for each class as the value.

It appears that the purpose of this map is so that when the class associated with an async request is retrieved (as a string of class name), AsyncRequestQueueable can retrieve the associated Type to call newInstance().

My question is why not just take the string of the class name from the async request and call Type.forName(<class name string>) to get the Type, on which you can then call newInstance()?

This would appear to eliminate the need to maintain the requestHandlers map, and eliminate the need for the getRequestType() method in each handler that just returns the class name. You would no longer need to update AsyncRequestQueueable every time you define a new handler class. You could still do exception handling if there is no handler class - you would just end up with null for the Type.

Any thoughts on whether this approach would cause any problems?

Thanks!!

Scott

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions