JBoss.org Community Documentation

5. Example POJOs

The example POJO classes used for PojoCache demo are: org.jboss.cache.pojo.test.Person and org.jboss.cache.pojo.test.Address . They are located under tests/functional directory.The demo will demonstrate that once a POJO has been attached to the cache, plain get/set POJO methods will be intercepted by the cache.

Here is the snippet of the class definition for Person and Address with the Replicable annotation.

@org.jboss.cache.pojo.annotation.Replicable
public class Person
{
   ...
   public String getName()
   {
      return name;
   }

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

   // ...

   public List<String> getLanguages()
   {
      return languages;
   }

   public void setLanguages(List<String> languages)
   {
      this.languages = languages;
   }

   // ...

   public Address getAddress()
   {
      return address;
   }

   public void setAddress(Address address)
   {
      this.address = address;
   }

   // ...
}
      
@org.jboss.cache.pojo.annotation.Replicable
public class Address
{
   // ...
   public String getStreet()
   {
      return street;
   }
   public void setStreet(String street)
   {
      this.street=street;
   }
   // ...
}