0
public without sharing class SecureMessageService {
    public Boolean isCase;

    public abstract class Request{
        public Boolean threadBySF {get {return this.getThreadBySF(); } }
        public String threadId { private set; get { return this.getThreadId(); } }

        public abstract String getThreadId();
        public abstract Boolean getThreadBySF(){
        
            String threadId = this.getThreadId();
            system.debug('threadId: '+threadId);
            String[] threadIdArray = threadId.split('_');
            System.debug(threadIdArray[0]); 
            System.debug(threadIdArray[1]); // salesforce.com'String.valueOf(threadId).split('_');
            String threadBySf = threadIdArray[1];
            Integer result = threadBySf.length();
            try{
                if( result == 15 || result == 18){
                    Id threadIdBySf = Id.valueOf(threadBySf);
                    system.debug('threadIdBySf: '+threadIdBySf);
                    Schema.SObjectType sobjectType = threadIdBySf.getSObjectType(); 
                    String sobjectName = sobjectType.getDescribe().getName(); 
                    system.debug('sobjectName: '+sobjectName);
                    if(sobjectName == 'Case'){
                        isCase = true; 
                    } else{
                        isCase = false;
                    }
                }
            }catch(Exception e){
                system.debug(e);
            } 
            return isCase;
        }
    }
}

1 Answer 1

2

No, abstract methods in an abstract class can only contain the method signature.

The point of abstract methods is that the child classes are forced to implement them.

Virtual methods are what you want here. They can be used in an abstract class, and provide a default implementation (which can be overridden in child classes, but don't need to be overridden).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.