Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [setter]

The tag has no usage guidance.

0
votes
2answers
42 views

Problem with understanding way of work with VF page

So my task is to get two dates from user and based on that do some fancy logic which will result in creation of table with data requested. To begin with i wanted to create small VFpage with two ...
-1
votes
1answer
26 views

How to invoke controller setter method in trigger beforeInsert()?

That is my VF page: <apex:page standardController="Lead" extensions="LeadDuplicateController" tabStyle="Lead"> <apex:pageBlock > <apex:pageBlockSection title="Lead ...
2
votes
2answers
81 views

How to access Class members decorated using { get; set; }

I'm trying to save on boilerplate code so tried to use { get; set; } idiom, but the function will not resolve. This is the class with decorated properties. public class Counter { private static ...
2
votes
2answers
21 views

Difference between using and not using get; set; in data passed from backend

What is the difference between using and not using get; set; in data passed from backend? I saw examples like this in Apex: using get; set; public with sharing class MyBackendController { ...
2
votes
1answer
206 views

Need help to cover {get; set;} methods on a TestClass

i need some help on a TestClass as i said above, bellow i wil show you what the class looks like and the TestClass: APEX CLASS: public with sharing class DirectDebitController { public class ...
1
vote
2answers
66 views

Visualforce getters are called before setter when selecting a select option

I've noticed that when I have an <apex:selectList/> with a value attribute that calls a setter method to set a value in the controller all my getters get called before the initial set call ...
0
votes
0answers
188 views

Getter and setter methods for wrapper class in salesforce

Please help me in clearing this doubt.. I have a wrapper class which I am using to store JSON values received from external system, on doing Json.deserialize it parses all the values as received. ...
0
votes
0answers
39 views

Why can't we use set(setter) without a get(getter)? [duplicate]

I need to just display the result of the user input field in following code: public class EX_1 { public Integer i1{set;} public Integer i2{set;} public Integer result=i1+i2; public Integer display(){ ...
-4
votes
1answer
235 views

Why is the setter method not working in the following code?

On running the following code in apex and visualforce respectively i am receiving following error: Error: Unknown property 'Setter_Method.Oportunities' Quick Fix Create Apex property '...
0
votes
1answer
96 views

How to invoke Blob setter method?

I have a class with the following getter/setter: public Blob csvFileBody{get;set;} I have a test method from where I need to invoke the blob setter from the controller class. Please advise how to ...
-6
votes
1answer
373 views

How to assign value for getter setter variable from Apex test class [closed]

Class A{ public object obj{get;set;} } Test Class Class A_Test{ //how to assign value fo obj variable }
4
votes
1answer
567 views

get set method for value in class

I have a class with a getter and setter method. Could anyone explain how this works. If I am correct it is suppose to get and set a variable between a visualforce page and apex class. Is this also ...
1
vote
2answers
63 views

Public Variable Returns Null

I am trying to return a JSON string to my controller for rendering on a Visualforce page. The query builds correctly and the JSON string builds locally within the method buildQuery. However my top ...
1
vote
1answer
298 views

DML is NOT Recommended in APEX Property Setter

I just got a strange recommendation from SalesForce support which was related to inability of APEX controller class to save value from VisualForce component to a custom setting. The recommendation ...
0
votes
1answer
83 views

Getter Setter between two Visualforce pages

I am confused how to use to getter setter in the situation of two Visualforce pages having different extensions. 1 VF Page(Main Page): This page calls Opportunity as Standard Controller and having ...
0
votes
1answer
187 views

param value returns null

I have below VF page.I am passing value from data table.value="{!rlist.Id}" is coming as null.So on button click it is throwing me error for below soql as selectedresourceid =null ...
9
votes
4answers
11k views

why we use {get; set;} syntax in wrapper class or in controller class

public class Wrapper { public String fname{get; set;} //why we use get; set; syntax here public String lname{get; set;} public String uname{get; set;} } also here public class Controller{ ...
0
votes
2answers
99 views

Null Pointer exception for a set<ID>

I have below code in apex constructor of the controller where it shows null pointer exception. Can someone please let me know if I have issues with declaration and also the workaround. for(...
0
votes
1answer
45 views

Problem with Rendered attribute behaving incorrectly. Seems to always return false when the page is loaded?

I must be doing something silly with my code, but cannot for the life of me figure out why neither the Boolean userNeedsVerify nor the method checkForVerify() are rendering when they should be. I've ...
0
votes
1answer
590 views

How to cover a getter/setter list (populated via query) in a unit test?

TL ; DR : I'm unable to fill a getter/setter list (that is filled via SOQL query) during testing. When unit testing a controller class, a certain {get;set;} list is not getting populated (it is null)...
5
votes
1answer
3k views

Simple getter setter

How to pass value from user side or vf page side by using this type of getter setter is there any way to pass value using this type? Here is the Code public class simplegetset { public String ...
0
votes
1answer
41 views

Different way to write getter and setter

Hi i have code that shows an error "Error: simplegetset Compile Error: Variable is not visible: userinput at line 14 column 15".I just want to know is this not right way to define get and set here is ...
1
vote
1answer
42 views

What is the behavior of a class attribute setter defined inline?

This came up in my answer on this other question I'm actually not 100% certain of the exact behavior of defining a setter method (does it completely override the standard setter? or is it run ...
4
votes
1answer
269 views

Setter not running on List.add()

Calling the add() method on a list doesn't force the setter to be called. First off, why is the setter not running? Secondly, is there a way to somehow override List.add() and steal the action, or do ...