In my previous question I want to get method references from ApexClassMember --> SymbolTable.

Following Daniel algorithm from his answer:

General steps to get the SymbolTable:

  1. Create a MetadataContainer record with a unique name. Record the MetadataContainerId
  2. Create a collection of ApexClassMember records referencing the MetadataContainerId. Populate the Body for each ApexClassMember with the corresponding ApexClass body. Populate the ContentEntityId with the Apex Class ID.
  3. Create a ContainterAsyncRequest for the MetadataContainerId. Use the IsCheckOnly option to avoid making changes.
  4. Keep retrieving the State until it is no longer Queued.
  5. Retrieve the ApexClassMember with the SymbolTable.

I read this post and copy necessary classes from this project. And I use UmlService.Compile method. He does all things He writes, If I all clearly understand:

  1. First of all He checks old container with name 'ApexNavigator' and Delete them If it is. Then create new and save.

  2. In next step he creates new ApexClassMember references to this container and save them too.

  3. Next step as you say creating a new ContainterAsyncRequest for the MetadataContainerId using the IsCheckOnly option. And save ContainterAsyncRequest too.
  4. -5 Finally I get ApexClassMember with SymbolTable and references, BUT:

Look further, I read that: "Once an ApexClassMember is successfully deployed in a MetadataContainer, the MetadataContainerId is changed to the ID of the ContainerAsyncRequest, and the ApexClassMember can’t be modified or reused." But I can't get ApexClassMembers only for this container because all ApexClassMember have MetadataContainerId = null. I really don't understand how it is possible if "this field is required". But if I delete any container all ApexClassMember for this container delete too. It is very important for me, because I want to get ApexClassMemers from specific container('ApexNavigator'), but I can only get all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.