The tag has no wiki summary.

learn more… | top users | synonyms

4
votes
3answers
68 views

Getting a type of the generic object

How to get a type of the generic object? I have a method that gets as parameter some object. It can be realy everything. In my example it is a list of strings. But it can be a map or set or some other ...
3
votes
1answer
54 views

Is it possible to create a method that uses generics? [duplicate]

... or at least pass in a specific class? Here is what I have right now: private static invoice_response GetResponse(String jsonResponse) { invoice_response deserialized = (invoice_response) ...
0
votes
0answers
30 views

Generic Trigger Pattern or Development Suggestion [duplicate]

I've been looking around the internet for a way to have a Generic Apex trigger that I could use on all Objects, but it seems like that is impossible. Basically, I wanted to build an app that would ...
3
votes
1answer
267 views

Is it possible to write a method that accepts both SObjects and Apex Class Instances?

I have an Apex method that takes a list of SObjects, a source field name, and a destination fieldname. For each SObject in the list, it looks at the source field, does some work, and populates the ...
14
votes
1answer
1k views

Generic Apex Trigger

So I was kind of throwing round the idea of making a generic apex trigger that is callable by multiple objects. Say you have the following sObjects: Account Sales__c Sales_Contacts__c And I wanted ...
7
votes
1answer
920 views

How do I use Type.forName to deserialize a generic list of SObjects?

When the new Apex type methods were added in Summer '12, it was possible to do Type t = Type.forName('MyClass'); MyClass newObj = (MyClass)t.newInstance(); What is the equivalent when I want to ...
5
votes
1answer
68 views

How to get the old Test Class UI back? Or possible workarounds with the new UI?

Is there anyone else who is sorely missing the old test class UI where it shows the entire list of Apex classes covered by running one test class? Another good feature of the old UI was that you could ...
4
votes
2answers
163 views

What is “Skip to main content”?

In any Salesforce page, if no element is in focus and you press Tab⇄, a hidden element Skip to main content is put into focus. What does Skip to main content do?
7
votes
1answer
2k views

What is the correct JSON to deserialize a map of sObjects?

I'm trying to store a map of sObjects in a static resource. I want to be able to store default values for test setup methods. I was able to get it working with the following JSON in the static ...
7
votes
4answers
613 views

How do you deserialize json into the correct virtual class?

Let's say I have a virtual class and two classes that extend it and I am getting a JSON response that could be either one of those classes. Is there a way to deserialize the JSON into the appropriate ...
10
votes
1answer
2k views

Can you use generics in Apex?

While researching the possibility of using generics in apex I can across a blog with this: "Generics are partially supported in Apex, you must be using them with Collections and Batch Apex." ...