1
2
3
4 package org.sourceforge.jemm.sample.demo1.model;
5
6 import org.sourceforge.jemm.Entity;
7 import org.sourceforge.jemm.lifecycle.AttributeUse;
8 import org.sourceforge.jemm.lifecycle.ConstructorLifecycle;
9 import org.sourceforge.jemm.lifecycle.ShadowUserObject;
10 import org.sourceforge.jemm.lifecycle.Uses;
11 import org.sourceforge.jemm.util.JEMMObject;
12
13
14
15
16
17
18 @Entity
19 public class Person implements JEMMObject{
20
21 protected ShadowUserObject jemmOIF;
22
23 protected String name;
24 protected Account account;
25
26
27
28
29
30
31 public Person(String name) {
32 ConstructorLifecycle.preConstructor(Person.class.getName());
33 ConstructorLifecycle.beginConstructor(this);
34 try {
35 this.name = name;
36 ConstructorLifecycle.endConstructor(this);
37 }catch(Throwable t) {
38 ConstructorLifecycle.failedConstructor(this);
39
40 throw new RuntimeException(t);
41 }
42 }
43
44
45
46
47
48 public Person(ShadowUserObject jemmOIF) {
49 this.jemmOIF = jemmOIF;
50 }
51
52
53
54
55
56
57
58 public String getName() {
59 jemmOIF.entityEntered("org.sourceforge.jemm.sample.demo1.model.Person#"
60 + "getName ()Ljava/lang/String;");
61 try {
62 return name;
63 } finally {
64 jemmOIF.entityExited("org.sourceforge.jemm.sample.demo1.model.Person#"
65 + "getName ()Ljava/lang/String;");
66 }
67 }
68
69 @Uses(@AttributeUse(clazz = "org.sourceforge.jemm.sample.demo1.model.Person", name = "account"))
70 public void setAccount(Account account) {
71 jemmOIF.entityEntered("org.sourceforge.jemm.sample.demo1.model.Person#"
72 + "setAccount (Lorg/sourceforge/jemm/sample/demo1/model/Account;)V");
73 try {
74 this.account = account;
75 } finally {
76 jemmOIF.entityExited("org.sourceforge.jemm.sample.demo1.model.Person#"
77 + "setAccount (Lorg/sourceforge/jemm/sample/demo1/model/Account;)V");
78 }
79 }
80
81
82
83
84
85
86
87 @Uses(@AttributeUse(clazz = "org.sourceforge.jemm.sample.demo1.model.Person", name = "account"))
88 public Account getAccount() {
89 jemmOIF.entityEntered("org.sourceforge.jemm.sample.demo1.model.Person#"
90 + "getAccount ()Lorg/sourceforge/jemm/sample/demo1/model/Account;");
91 try {
92 return account;
93 } finally {
94 jemmOIF.entityExited("org.sourceforge.jemm.sample.demo1.model.Person#"
95 + "getAccount ()Lorg/sourceforge/jemm/sample/demo1/model/Account;");
96 }
97 }
98 }