Lines 33-64
Link Here
|
33 |
new WeaveMessageKind(5,"Softening exceptions in type '%1' (%2) as defined by aspect '%3' (%4)"); |
33 |
new WeaveMessageKind(5,"Softening exceptions in type '%1' (%2) as defined by aspect '%3' (%4)"); |
34 |
|
34 |
|
35 |
|
35 |
|
|
|
36 |
private String affectedtypename; |
37 |
private String aspectname; |
38 |
|
39 |
|
36 |
// private ctor - use the static factory method |
40 |
// private ctor - use the static factory method |
37 |
private WeaveMessage(String message) { |
41 |
private WeaveMessage(String message, String affectedtypename, String aspectname) { |
38 |
super(message, IMessage.WEAVEINFO, null, null); |
42 |
super(message, IMessage.WEAVEINFO, null, null); |
|
|
43 |
this.affectedtypename = affectedtypename; |
44 |
this.aspectname = aspectname; |
39 |
} |
45 |
} |
40 |
|
46 |
|
41 |
/** |
47 |
/** |
42 |
* Static helper method for constructing weaving messages. |
48 |
* Static helper method for constructing weaving messages. |
43 |
* @param kind what kind of message (e.g. declare parents) |
49 |
* @param kind what kind of message (e.g. declare parents) |
44 |
* @param inserts inserts for the message (inserts are marked %n in the message) |
50 |
* @param inserts inserts for the message (inserts are marked %n in the message) |
|
|
51 |
* @return new weaving message |
52 |
*/ |
53 |
public static WeaveMessage constructWeavingMessage( |
54 |
WeaveMessageKind kind, |
55 |
String[] inserts) { |
56 |
StringBuffer str = new StringBuffer(kind.getMessage()); |
57 |
int pos = -1; |
58 |
while ((pos=new String(str).indexOf("%"))!=-1) { |
59 |
int n = Character.getNumericValue(str.charAt(pos+1)); |
60 |
str.replace(pos,pos+2,inserts[n-1]); |
61 |
} |
62 |
return new WeaveMessage(str.toString(), null, null); |
63 |
} |
64 |
|
65 |
/** |
66 |
* Static helper method for constructing weaving messages. |
67 |
* @param kind what kind of message (e.g. declare parents) |
68 |
* @param inserts inserts for the message (inserts are marked %n in the message) |
45 |
* @param affectedtypename the type which is being advised/declaredUpon |
69 |
* @param affectedtypename the type which is being advised/declaredUpon |
46 |
* @param aspectname the aspect that defined the advice or declares |
70 |
* @param aspectname the aspect that defined the advice or declares |
47 |
* @return new weaving message |
71 |
* @return new weaving message |
48 |
*/ |
72 |
*/ |
49 |
public static WeaveMessage constructWeavingMessage( |
73 |
public static WeaveMessage constructWeavingMessage( |
50 |
WeaveMessageKind kind, |
74 |
WeaveMessageKind kind, |
51 |
String[] inserts) { |
75 |
String[] inserts, |
|
|
76 |
String affectedtypename, |
77 |
String aspectname) { |
52 |
StringBuffer str = new StringBuffer(kind.getMessage()); |
78 |
StringBuffer str = new StringBuffer(kind.getMessage()); |
53 |
int pos = -1; |
79 |
int pos = -1; |
54 |
while ((pos=new String(str).indexOf("%"))!=-1) { |
80 |
while ((pos=new String(str).indexOf("%"))!=-1) { |
55 |
int n = Character.getNumericValue(str.charAt(pos+1)); |
81 |
int n = Character.getNumericValue(str.charAt(pos+1)); |
56 |
str.replace(pos,pos+2,inserts[n-1]); |
82 |
str.replace(pos,pos+2,inserts[n-1]); |
57 |
} |
83 |
} |
58 |
return new WeaveMessage(str.toString()); |
84 |
return new WeaveMessage(str.toString(), affectedtypename, aspectname); |
59 |
} |
85 |
} |
60 |
|
86 |
|
|
|
87 |
/** |
88 |
* @return Returns the aspectname. |
89 |
*/ |
90 |
public String getAspectname() { |
91 |
return aspectname; |
92 |
} |
61 |
|
93 |
|
|
|
94 |
/** |
95 |
* @return Returns the affectedtypename. |
96 |
*/ |
97 |
public String getAffectedtypename() { |
98 |
return affectedtypename; |
99 |
} |
62 |
|
100 |
|
63 |
public static class WeaveMessageKind { |
101 |
public static class WeaveMessageKind { |
64 |
|
102 |
|