+ Start a Discussion
SKumar SFDCSKumar SFDC 

Help to understand code

Dear Experts,

I'm new bee to APEX (and programing), can you pls explain me to understand below code (bold Highlighted):
- encriptedFieldsMap.put, What Map gets if inner class constructor calls?

Request: I'm new to programming, kindly articulate your answer in a lay man language.. thanks in advance.

Thanks,
Srujan

public class EncriptFieldValueMover {
   
    public Map<String,EncriptFieldValueMover.EncriptedField> encriptedFieldsMap {get;private set;}
    public String fieldApiName = 'FieldAPI';
    public Account encFieldCS;
   
    public EncriptFieldValueMover(){
        encriptedFieldsMap = new Map<String,EncriptFieldValueMover.EncriptedField>();
        encriptedFieldsMap.put(fieldApiName,new EncriptFieldValueMover.EncriptedField(fieldApiName,encFieldCS));
    }
 
    public class EncriptedField{
        private String fieldAPIName;
        private String elatedEncriptedField;
        public account encFieldCS {get; private set;}
       
        public EncriptedField(String fieldAPIName, Account encFieldCS){
            this.fieldAPIName = fieldAPIName;
            this.encFieldCS = encFieldCS;
        }
       
        public String getFieldAPIName(){
            return fieldAPIName;
        }
       
        public String getRelatedEncriptedField(){
            return encFieldCS.Name;
        }
    }
}
sandeep reddy 37sandeep reddy 37
This coad is used for getting the field name from account for that they use EncriptedField class but you provided apiname in class 1
 
using this apiname TO pass a parameter in constracter

after that all details inserted in map 
apiname is key

using put method they done\

 encriptedFieldsMap.put(fieldApiName,new EncriptFieldValueMover.EncriptedField(fieldApiName,encFieldCS));
right?

 I
 HOPE you are dought is clear