I was able to get the names of all the apex classes in an org using metadata api with Java
public void getApexClasses() throws ConnectionException {
ListMetadataQuery[] queries = new ListMetadataQuery[1];
ListMetadataQuery queryApexClass = new ListMetadataQuery();
queryApexClass.setType("ApexClass");
queries[0] = queryApexClass;
FileProperties[] fileProperties = mConnection.listMetadata(queries, 29.0);
for(FileProperties fileProperty : fileProperties) {
System.out.println(fileProperty.getType() + ":" + fileProperty.getFullName());
}
}
Now, I would like to get the content of each of these apex classes. How can I do that?
ApexClass apexClass = new ApexClass();
// Some code to load the apexClass instance - HELP required
System.out.println(apexClass.getContent());