function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC_LearnerSFDC_Learner 

Reg: Get and set Methods

HI

Can any one explain me abou get and set methods in apex?

 

give a samplel program to understand these methods?

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

Here is the complete description with example.

 

http://www.forcetree.com/2009/07/getter-and-setter-methods-what-are-they.html

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Here is the complete description with example.

 

http://www.forcetree.com/2009/07/getter-and-setter-methods-what-are-they.html

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
SFDC_LearnerSFDC_Learner

Thanks Ankit.

This example is too good.

 

 

SFDC_LearnerSFDC_Learner

HI

Between get() and set() methods which method executes first?

 

Ankit AroraAnkit Arora

It depends : when you fetch the value of the property get method comes in role and if you set the value in property set method comes in role.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Kumaravel MathivananKumaravel Mathivanan
It was Good. Easy to understanding.
Kshma SinghKshma Singh
Its good .Thanks
George_ThomasGeorge_Thomas
Thanks @Ankit Arora
Hajie CarpioHajie Carpio
Hi,

I have a class defined:
public with sharing class ScheduleSlotControllerApx

with a property
public string DPSURL{get; set;}

in the visual force page it is mapped to 
<apex:form id="cciForm0"> 
<apex:inputText label="DSP URL" value="{!DPSURL}" id="DPSURL"/>
</apex:form>

then i have a button that calls a FetchScheduleSlotInfo method, in another form
<apex:form id="cciForm">        
         <!-- The rerender attribute causes addressList to be re-rendered when the button is clicked -->
         <apex:commandButton action="{!ViewScheduleSlotInfo}" value="Load Schedule Slots!" rerender="cciForm" status="callZipAPIStatus">         
         </apex:commandButton>
</apex:form>

in the code i have line of code 
System.debug('setPropertyValues URL - ' + this.DPSURL); 

to see if i'm able to get the updated value of the property.
 
Gargee MukherjeeGargee Mukherjee
@Ankit Arora
That link you shared was really helpful. Thanks a lot.