Contents
What is an instance of a class in Apex?
Advertisements. An instance of class is called Object. In terms of Salesforce, object can be of class or you can create an object of sObject as well.
What is type forName in Apex?
Usage. Use the forName methods to retrieve the type of an Apex class, which can be a built-in or a user-defined class. You can use these methods to retrieve the type of public and global classes, and not private classes even if the context user has access.
How to create a dynamic string in apex?
You pass the name of the Type you want to construct into the Type.forName method. You probably will want to implement an interface here as well. Something like: If you do have a need to pass parameters to the dynamically created class, a way to do that is to create the class by using JSON.deserialize: assuming configClass is a sub-type of Process.
How to create apex class instance using class name?
There is a custom object which stores the Schedulable Apex Classes. The requirement is to create Schedulable apex jobs for all of them using System.schedule method but it allows only instance of a Schedulable apex class as an input parameter, and not able to create an instance using the class name. This is how we have done this:
How to create an abstract class in apex?
I have an abstract class called Process that I extend to create a list of processes ( List ); each in relation to an object. For now everything works as expected but I’m really hoping to create a very dynamic approach to these processes.
Can you create schedulable apex jobs using system.schedule?
The requirement is to create Schedulable apex jobs for all of them using System.schedule method but it allows only instance of a Schedulable apex class as an input parameter, and not able to create an instance using the class name. This is how we have done this: This is one of the great feature introduced in Summer 12.