Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is POJO & DOJO in JAVA? [closed]

Tags:

java

pojo

I have many doubts in POJO. And seek for a clear definition with a tiny example.

like image 243
JDGuide Avatar asked Jul 30 '12 13:07

JDGuide


People also ask

What is POJO and why it is used?

POJO stands for Plain Old Java Object. It is an ordinary Java object, not bound by any special restriction other than those forced by the Java Language Specification and not requiring any classpath. POJOs are used for increasing the readability and re-usability of a program.

What is POJO in Java with example?

POJO in Java stands for Plain Old Java Object. It is an ordinary object, which is not bound by any special restriction. The POJO file does not require any special classpath. It increases the readability & re-usability of a Java program. POJOs are now widely accepted due to their easy maintenance.

What is POJO class in spring boot?

POJO is short for Plain old java object, an application implemented in pojo way means the logic resides in POJO with little to no boilerplate code, thus it's very portable. An PoJo application can be ported from Spring to another container with little modification.

What is POJO structure?

In simpler terms, Pojo is defined as a pure data structure, containing the getter and setter fields. It has the ability to override certain methods from Object or an interface such as Serializable. They were introduced in EJB 3.0 by Sun Microsystems and are widely used since they are easy to write and understand.


2 Answers

POJO Plain Old Java Object. Basically a class with attributes and it's getters and setters.

public class User{
 private String name;
 private int age;

 public void setName(String name){
    this.name = name;
 }

 public String getName(){
    return this.name;
 }

 //same for age

}

DOJO haven't heard of it. A JavaScript framework. :)

like image 160
Nishant Avatar answered Oct 05 '22 08:10

Nishant


pojo : plain old java object

dojo : http://dojotoolkit.org/ A javascript ajax framework though has nothing to do with java

EDIT 1:

eg. for pojo class:

public Customer{
  private String name;
  private String surname;

  public String getName(){
    return name;
  }
  public String getSurname(){
    return surname;
  }
  public void setName(String name){
    this.name=name;
  }
  public void setSurname(String surname){
    this.surname=surname;
  }
}
like image 29
fmucar Avatar answered Oct 05 '22 09:10

fmucar