Questions tagged [getter]

A getter is a public accessor method, used in object-oriented programming, which returns the value associated with a private member of a class.

A getter is public method, used in object-oriented programming, which returns the value associated with a private member of a class. A getter often refers to the get portion of a property. The getter method may perform other tasks such as validation, but is usually considered non-mutating.

1882 questions
0
votes
1 answer

Rails Getter method inside a query

I have a getter method in my Rails model like this def abc self.a * self.b * self.c end Is there any way I can use this method inside my sql query like this. Model.where("abc >=?", 10)
Nidhin S G
  • 1,685
  • 2
  • 15
  • 45
0
votes
1 answer

Async with property in C#

I have a property. In getter, I want to call a async method. Please look into code I have also marked comments:- public string AuthToken { get { TimeSpan timediff = App.Locator.Login.TokenExpire_On.ToLocalTime() -…
Gurpreet Singh
  • 165
  • 4
  • 18
0
votes
1 answer

Android Retrofit GET

I am new to Retrofit and built a simple app using it. But when I tried to run the app, it didn't display the data fetched from the web. However, the api hits are increasing each time. Kindly help me solve this out. Thanks in advance. Main…
0
votes
1 answer

why don't spring getter methods follow javabean convention?

I walked across many Spring tutorials explaining @Configuration and @Bean annotations, and always the @Bean annotation is put above a method that is returning some Spring bean but never follows the java bean getter standard. for example…
osama yaccoub
  • 1,884
  • 2
  • 17
  • 47
0
votes
1 answer

Android: Getter of database in SQLite

I created database at stClass, and I want to use the same database in other class( ndClass). Android studio wanted to make all static so I did it, but i cannot resolve that cannot be referenced from a static field stClass: public static Base db=…
Xalion
  • 623
  • 9
  • 27
0
votes
2 answers

JavaFX - Getter for focused TextField out of an array of TextFields

I am looking for a way to forsee a getter in my program. I have a bunch of TextFields created dynamically: fields = new TextField[105]; for (int i = 0; i < fields.length; i++) { fields[i] = new TextField(); } In my program it looks like…
0
votes
0 answers

are there no private vars in ecma6 classes?

I feel kind of stupid about this, but from what I've searched and read I understand that there is no way to create a truely private var in ecma6 classes. am I correct? this is an examplee of a getter function in emca5, is there anyway to do this in…
Shai Kimchi
  • 746
  • 1
  • 4
  • 22
0
votes
1 answer

How does #{ManagedBean.all} call ManagedBean.getAll()

I'm not understanding how results in a function within the ManagedBean class getAll() being called. I understand that calls the constructor of the…
Mushy
  • 2,535
  • 10
  • 33
  • 54
0
votes
1 answer

How to make difference between Android SDK method and my own method

I'm trying to parse a JSON with GSON in an AsyncTask The issue is : I have the method android.os.AsyncTask.getStatus and my own getter for my own class Status (this class is the parsing of my JSON file) Can i set a nickname or something like this…
CSecchi
  • 13
  • 3
0
votes
1 answer

Date as a constructor and as a function

var a = Date; Object.defineProperty(window, "Date", { get: function() { console.log(this); return a; } }); (new Date); Date(); How can I know, when Date is being called as a constructor(with "new"), and when it's being called as a…
0
votes
1 answer

Java keeps skipping over my scanner objects

This is very puzzling to me. I am trying to understand how to fix this problem of Java not recognizing that my "setTitle" method exists after the first "Song." This is a music application program. It has two other classes. All help would be very…
Computer
  • 132
  • 11
0
votes
1 answer

Could not determine type for at table for columns

I have a class @Getter @Setter @Entity public class Product { @Id @GeneratedValue private Long id; } // ----------------------------------- @Entity @Getter @Setter public class ProductPrice { @Id public Long getId() { …
Mirza
  • 281
  • 1
  • 4
  • 14
0
votes
3 answers

How to check the return value of the method with the value of the string?

I have to check the return value of the method, if it equals the value of a string which is either "Yes" or "No" or should I use a regex which matches with the pattern of the string i.e Yes or No. So essentialy, I am trying to write in this way …
Soom Satyam
  • 25
  • 1
  • 1
  • 7
0
votes
1 answer

How to pass arguments to setter in javascript object?

I have an object which is a list of filters corresponding to a select list. When the user selects from a drop-down I want update the object using this getter/setter. I'm also using an event listener. I thought the argument would be automatically…
icicleking
  • 1,029
  • 14
  • 38
0
votes
2 answers

when we have setter for setting value then why do we use parameterized constructor

When we have setter function for setting value then why do we need parameter constructor ? is it necessary to use ? is it good if we want to use constructor instead of setter and after that can we access our data using getter functions?