+ Start a Discussion
lopezclopezc 

Is is posible to have the interface in a separate file?

Can I have SalesforceComponent class in a separate file? At the moment it only works if I put them together:

 

 

public without sharing class Components {

public interface Component {

String getDescription(Case caseN);

String getComponentName();

}

public class SalesforceComponent implements Component{

public String getDescription(Case caseN){

String template = '';

template += 'Desk move:' + (String)((caseN.HEAT_Desk_Move__c)? 'Yes' : 'No') + '\n';

template += 'Report/Dashboards:' + caseN.HEAT_Salesforce_ReportDasboards__c + '\n';

if(caseN.HEAT_Salesforce_ReportDasboards__c){

template += 'Changes Required:' + caseN.HEAT_Salesforce_ReportDashboar_Changes__c + '\n';

template += 'Link to Existing Report:' + caseN.HEAT_Salesforce_ReportDashboar_Link__c + '\n';

}

template += 'New User:' + (String)((caseN.HEAT_Salesforce_New_User__c)? 'Yes' : 'No') + '\n';

if(caseN.HEAT_Salesforce_New_User__c){

template += 'New User Username:' + caseN.HEAT_Salesforce_New_User_Username__c + '\n';

template += 'New User Email Address:' + caseN.HEAT_Salesforce_New_User_Email__c + '\n';

template += 'New User Team:' + caseN.HEAT_Salesforce_New_User_Team__c + '\n';

}

template += 'Demo Conversion:' + (String)((caseN.HEAT_Salesforce_Demo_Conversion__c)? 'Yes' : 'No') + '\n';

template += 'Webinar:' + (String)((caseN.HEAT_Salesforce_Webinar__c)? 'Yes' : 'No') + '\n';

template += 'Other Area:' + caseN.HEAT_Salesforce_Areas__c + '\n';

template += 'More Details:' + caseN.HEAT_Salesforce_More_Details__c + '\n';

return template;

}

public String getComponentName(){

return 'Salesforce';

}

}

} 

 

 

Message Edited by lopezc on 03-18-2010 05:05 AM
Best Answer chosen by Admin (Salesforce Developers) 
lopezclopezc

Ignore me, I have found the way, pretty easy :)

 

One file:

 

public interface Component{

 ...........

}

 

other file:

 

public class ComponentA implements Component{

 ............