[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] access properties from class
|
Hi all,
how can I access properties defined inside a class into which an aspect
is inserted?
I'm trying to extend the log4j PatternParser so it recognizes custom
conversion characters,
1: public aspect xPatternParser {
2:
3: void around(PatternParser pp, char c):
4: all(void finalizeConverter(char)) && target(pp) && args(c)
5: {
6: if(c=='i')
7: pp.addConverter(new IPConverter(formattingInfo)) ;
8: else
9: proceed(pp,c) ;
10: }
11:
12: private class IPConverter extends PatternConverter {
13:
14: IPConverter(FormattingInfo formattingInfo) {
15: super(formattingInfo);
16: }
17:
18: public String convert(LoggingEvent event) {
19: return event.getIP() ;
20: }
21: }
22:
23:}
in line 7 I tried to access a property and method I know PatternParser
has but two errors ocurr:
7: [error] The method addConverter(PatternConverter) from the type
PatternParser is not visible
pp.addConverter(new IPConverter(formattingInfo)) ;
^^^^^^^^
7: [error] formattingInfo cannot be resolved
pp.addConverter(new IPConverter(formattingInfo)) ;
^^^^^^^^^^
so how can I access properties from the class I'm trying to extend?
regards,
Gerardo