PROPERTIES OF BEANS in JAVA TECHNOLOGY

PROPERTIES OF BEANS in JAVA TECHNOLOGY
PROPERTIES OF BEANS in JAVA TECHNOLOGY

3 TYPES OF PROPERTIES :

1. SIMPLE
2. BOOLEAN
3. INDEXED

Simple property has a single value .

It is identified by following
design pattern:

public T getN();
public void setN(T arg);

T = type N = name

– Read only property has only get method.
– Write only property has only set method

Example:

public class Box
{
private double depth, height;
public double getDepth();
{
return depth;
}
public void setDepth(double d)
{
depth=d;
}
public double getHeight();
{
return height;
}
public void setHeight(double h)
{
height=h;
}
}

Boolean property :

public boolean isN()
public void setN(boolean value)

Example:

pubilc class line
{
private boolean dotted = false;
public boolean isDotted();
{ return dotted; }
public void setDotted(boolean d)
{ this.dotted = d ; }
}

Index property consists of Multiple values :

public T getN(int index)
public void setN(int index,T value)
public t[] getN();
public void getN(T values[]);

Design pattern for events :

– Bean use event deligation model for events
– Bean can generate events and send to objects

public void addTListener(Tlistner eventListener)
public void removeTListener(Tlistner eventListener)

Leave a Reply