Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is plain-vanilla JavaBeans & plain-vanilla Java Class?

Tags:

java

spring

what is the Technical meaning of this context plain-vanilla Java Beans & plain-vanilla Java Class ??.

like image 726
Big Bang Theory Avatar asked Sep 15 '10 08:09

Big Bang Theory


1 Answers

A 'plain-vanilla' bean/class means a very basic class usually with the following properties;

  • Doesn't extend or implement anything
  • Has private class variables
  • Has an empty constructor
  • Has standard getter/setter methods

This is also called a POJO (Plain Old Java Object). For example;

public class MyPojo
{
    /*
     * Private class variables
     */
    private String name;
    private int size;

    /**
     * Empty constructor
     */
    public MyPojo()
    {
    }

    /*
     * Standard getter/setters 
     */
    public String getName()
    {
        return name;
    }

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

    public int getSize()
    {
        return size;
    }

    public void setSize(int size)
    {
        this.size = size;
    }   
}
like image 98
Qwerky Avatar answered Oct 12 '22 23:10

Qwerky