Site Navigation:

sbean

Getting and setting properties

All services are provided by the SBeanUtil class. A simple demonstration is provided in the sbeansamp package {@link org.otvl.sbeansamp.Main} class:

private void run()

throws Exception

{

Sample1 s1 = new Sample1();

s1.setAtt1(1); // set attribute att1 with value 1

SBeanUtil.setSimple(s1,"att1",new Integer(2)); // same with value 2

int i = s1.getAtt1(); // returns 2

s1.setTheSample2(new Sample2("s2-1")); // set link "theSample2"

SBeanUtil.setSimple(s1,

"theSample2",new Sample2("s2-2")); // same with new other object

s1.addTheSamples3(new Sample3("s3-1")); // append in link "theSample3"

SBeanUtil.addIndexed(s1,

"theSamples3",new Sample3("s3-2")); // same with new other object

s1.putS3byId("s3-2",new Sample3("s3-2")); // put in map link "s3byId"

SBeanUtil.setMapped(s1,

"s3byId","s3-3",new Sample3("s3-3")); // same with new other object

Sample3 s3 = (Sample3)SBeanUtil.getMapped(s1,

"s3byId","s3-3"); // retrieves this object

System.out.println("");

}