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 [getter]

The tag has no usage guidance.

0
votes
0answers
11 views

Visualforce component custom getter breaking page commandLinks

I've seen this a few times and want to understand how to handle it. If I have a visualforce component with a custom getter (which I need to run initialize code for that component) embedded in a vf ...
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 ...
2
votes
2answers
80 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 { ...
1
vote
1answer
54 views

JQuery and Disabled Attributes

I am unable to get this bit of JS to work. I have a few questions: Am I not allowed to put the disabled attribute on the apex:inputField? Am I importing the JS url incorrectly? Is it possible that ...
2
votes
1answer
205 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
0answers
63 views

Overloaded Getter Methods for Apex Property

I've a little confused by the order of execution in the following very useful class from Adrian Larson. If I call "get" with just an SObjectType, invoking the first method, the cache.containsKey(key) ...
1
vote
2answers
106 views

setting RecordType in Test Coverage

I am having trouble on a test that is setting a record type. I believe I am setting the record type the correct way, the test is passing, but my test coverage is telling me that no record type was set....
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 ...
1
vote
2answers
55 views

Setter value not arriving in apex class

I have a list that contains a collection of wrapper class instances called tacList. The wrapper class effectively contains a checkbox which relates to a case field and a string. The string is not ...
0
votes
0answers
187 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
233 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 '...
4
votes
1answer
329 views

Overriding Getters and Setters from Base Class

I'm trying to convert an old global class to be a virtual class so I can have some variations on its implementation. There is some existing behavior on the property Getters that I'd like to preserve ...
-6
votes
1answer
372 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 }
0
votes
1answer
272 views

How to get related object fields without the id in a query

I am working through a class that runs on before insert on the OpportunityLineItem object. Basically, I create a key on the OLI record, search for an existing custom object (Responsible Party) ...
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
2answers
274 views

Pull multiple fields from an object in get;set;

I have the following code linked to a vf page for a basic custom related list. I've figured out that it is not working due to not pulling the mr.Sample_ID__cbecause the get;set; at the top only pulls ...
6
votes
2answers
604 views

Need help understanding get/set methods, weird behavior

I came across this question somewhere which has been kept me engaged thinking why it is behaving this way. Lets say I have an apex class: public class TestController { public String myString{...
1
vote
1answer
156 views

Need clarification on a getter

I have a custom visualforce page and controller extension that is working. There is one getter that I do not understand why it works. I was hoping someone could explain it to me. In the below code I ...
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 ...
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{ ...
3
votes
1answer
618 views

How to test a class that contains no methods

I have a class that only contains one map. public with sharing class testController { public Map<String, User[]> mapName {get {.....return value;} set;} } I am unable to instantiate the ...
0
votes
1answer
31 views

Turn public list to set with returning unique values

I have below declaration for a public list which I need to make a set so that only unique values show up. If not Set atleast I need this list to return unique values. Can someone please help me? Apex ...
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 ...
0
votes
1answer
323 views

Init field with setter and getter

I can write Integer var {get; set;} but can not Integer var {get; set;} = 0 or Integer var = 0 {get; set;} Is it impossible to init field with set-get at the same line?
4
votes
1answer
160 views

Visualforce Private vs Public Getter/Setter Syntax/Structure & Order of Execution

There are already many threads on the confusion with Visualforce's Lifecycle/Execution Order, as their should be because its pretty confusing the more complicated your applications becomes. With that ...