View Javadoc
1   package ejava.examples.orm.core.mapped;
2   
3   import org.slf4j.Logger;
4   import org.slf4j.LoggerFactory;
5   
6   /**
7    * This class provides an example of using LAZY fetch hints. We use 
8    * log statements in the setters and getters to track activity within
9    * the objects.
10   */
11  public class Umbrella {
12      private static final Logger log = LoggerFactory.getLogger(Umbrella.class);
13      private long id;
14      private String make;
15      private String model;
16      
17      public Umbrella() {
18          trace("ctor()");
19      }
20      public Umbrella(long id) {
21          trace("ctor(" + id + ")");
22          this.id = id; 
23      }
24      
25      public long getId() {
26          trace("getId()=" + id);
27          return id;
28      }
29      protected void setId(long id) {
30          trace("setId(" + id + ")");
31          this.id = id;
32      }
33      public char[] getMake() {
34          trace("getMake()=" + make);
35          return make.toCharArray();
36      }
37      public void setMake(char[] make) {
38          trace("setMake(" + new String(make) + ")");
39          this.make = new String(make);
40      }
41      public String getModel() {
42          trace("getModel()=" + model);
43          return model;
44      }
45      public void setModel(String model) {
46          trace("setModel(" + model + ")");
47          this.model = model;
48      }
49  
50      public String toString() {
51          return super.toString() +
52             "make=" + make +
53             ", model=" + model;
54      }
55      private void trace(String message) {
56          log.debug(super.toString() + ":" + message);
57      }
58  }