Skip to main content

All Questions

Tagged with
3 votes
2 answers
577 views

Is there a way of accessing the properties of an object in java by using a string to represent the property's name, just like in JavaScript?

In JavaScript you can access a property of an object in two ways: object.property object["property"] In Java, I am only aware of the first way. Is there a way to access a Java object's ...
Dark Rebellion's user avatar
0 votes
1 answer
235 views

Get object properties from a generic object in java

I have a method to get properties from a generic object in c# below. How can I get the same in java? public string GetProperty<T>(T obj) { var s = string.Empty; ...
Yeasin Arafat's user avatar
1 vote
1 answer
403 views

How to use properties value as fixed value map at spring framework?

I have to mapping properties value as public static immutable Map. I googling hard n have been try many solution to my code, but they always return null. I try many way but nothing works for me..   ...
seleveal's user avatar
0 votes
1 answer
609 views

How to add properties functions to objects from another class in Java?

In Javascript we can define an object like this 👇 let obj={ property1:67, func1: function (){ //Some code } } Now if we want add a new property to obj I can just add a new ...
Ruthvik's user avatar
  • 830
0 votes
1 answer
995 views

How do I access an object property/key in Java (Android) by string variable

EDIT: To clarify, I want to get the value of the property, not the name of the property. I know the name of the property but I need to access the property via a string containing the property name. I ...
Dan's user avatar
  • 11
1 vote
1 answer
279 views

Can't access object properties inside Arraylist inside another Arraylist, Java

This is the class that creates the objects: class cards_type{ String color; String number; public cards_type(final String input_color, final String input_number) { color = input_color; ...
scotby's user avatar
  • 19
0 votes
1 answer
2k views

How to add multiple properties to objects more efficiently

I've been messing around with Java, and I've set a JButton as so: JButton operator = new JButton; When I try to set a property for JButton operator, it works: operator.setFont(new Font("Chalkboard",...
MattGotJava's user avatar
2 votes
1 answer
2k views

java copy ONLY non-null modified properties value from one object to another object

In my Java application, copy ONLY non-null modified properties value from one object to another object. Class Emp{ private String name; private int age; private String city; // setter ...
Manu's user avatar
  • 1,253
2 votes
2 answers
4k views

Set Values in JAVAFX table view -objects with another object

My DTO Object contain another two objects. I need to set the value of those also in to the table. controller.java package controller; import com.jfoenix.controls.JFXButton; import com.jfoenix....
KNB's user avatar
  • 117
0 votes
0 answers
733 views

How to copy properties from one object to another?

I am implementing a audit service and I want to copy properties of the auditing object to the log object. The log object contains the same properties as the auditing object and some additional ...
Sidath Munasinghe's user avatar
2 votes
6 answers
12k views

How to exclude in JSON property of an object (inside output class)?

Let's say I an output class that will be converted to JSON: StudentSummary.java public class StudentSummary { private StudentList studentList; // getters setters } and StudentList.java ...
Hekky TwoFiveEightNine's user avatar
-3 votes
1 answer
368 views

Cant access object properties java

List<Employeee> employees = new ArrayList<>(); Scanner scanner = new Scanner(System.in); String[] input = new String[6]; int n = Integer.valueOf(scanner.nextLine()); for (int i = 0; i < ...
Все Едно's user avatar
2 votes
1 answer
1k views

Instantiate objects by configuration file on java

I have this object: public class TheObjectToInstantiate{ public String Name; public String Surname; public TheObjectToInstantiate(){ } } I want to instantiate an array of TheObjectToInstantiate[]...
davymartu's user avatar
  • 1,433
3 votes
3 answers
9k views

Java Arraylist<Object> want to merge the objects if they have the same property value

Java ArrayList, filled with objects called packinglistrows which hold three key values ( ISBN, PalletNumber, Quantity), along with other properties. I have this ArrayList with all the same ISBN ...
perkss's user avatar
  • 1,057
0 votes
1 answer
108 views

Change Object properties without defining in a seperate class

Hi I've run into an issue in one of my programs which I have demonstrated below (not the actual program this just makes the problem clear.) Anyway I need to change the properties of an object in ...
scorch855's user avatar
  • 302

15 30 50 per page