You need to sign in to do that
Don't have an account?
Retrieve List of all available apex class in organisation
Hi ,
I have a requirement wherein i need to retrieve a list of all the apex classes that are available in my org in a custom visual force page. So wht shall i do to achive this. Wht will be controller of that particular visualforce page. How can i get list of all apex classes in my organisation.
Any sort of help would be greatly appreciated. Thanks in advance.
Hi,
Page Code:
<apex:page controller="RetrieveClasses" action="{!names}">
<apex:pageBlock >
<!-- End Default Content REMOVE THIS -->
<apex:pageBlockTable value="{!classNames}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:page>
Apex Code:
public class RetrieveClasses {
public List<ApexClass> classNames{set;get;}
public void names()
{
classNames=[SELECT id, name from ApexClass];
}
}
VF PAGE
<apex:page controller="GetAllApexClasses">
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value="{!apexclassList}" var="apexclass">
<apex:column >
<apex:outputField value="{!apexclass.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller
public class GetAllApexClasses{
public List<ApexClass> apexclassList{get;set;}
public GetAllApexClasses(){
apexclassList = new List<ApexClass>();
apexclassList = [SELECT ID,Name from ApexClass];
}
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
The Page :
The simple controller :