• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Should I call this Class as POJO or Java Bean?

 
Ranch Hand
Posts: 1257
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a Java Class which have nothing but only setters and getters for name and age. I then parse some input data extract name and age and set them on that object using the setter. I then convert this object to JSON.

Will this class be called as a POJO or a Java Bean. I have one more doubt what is the one common generic name for such kind of class accross multiple languages like Java, C#, Scala ?

Thanks
 
Saloon Keeper
Posts: 10669
228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you call it anything special?
 
Monica Shiralkar
Ranch Hand
Posts: 1257
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For e. g The name of XYZ in Java is POJO, the name for XYZ in C# is POCO. I want to know XYZ.
 
Stephan van Hulst
Saloon Keeper
Posts: 10669
228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seriously, what's wrong with just 'class'?
 
Monica Shiralkar
Ranch Hand
Posts: 1257
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have to do something similiar to what I have written in my first post in a language other than Java(say C#) , then I have search for XYZ in C#. I know the answer here is POCO but to arrive at this answer POCO  I require to search by that XYZ.
 
Rancher
Posts: 3371
31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call it either one, really.  It certainly fits the original definition of a Java Bean.  It's also a POJO. From what you say, it's also probably a DTO.  
 
Monica Shiralkar
Ranch Hand
Posts: 1257
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, in Java the class with getters setters is called bean. If I have to search in some other programming language about the class with getters setters is there a common word for it or may be I need to search by  "getters" "setters"
 
Don't listen to Steve. Just read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!