1 | |
package org.apache.onami.configuration.variables; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.util.ArrayList; |
23 | |
import java.util.Arrays; |
24 | |
import java.util.List; |
25 | |
import java.util.Map; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
final class MixinAppender |
31 | |
extends AbstractAppender |
32 | |
{ |
33 | |
|
34 | |
|
35 | 442 | private final List<Appender> appenders = new ArrayList<Appender>(); |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public MixinAppender( String chunk, Appender... appenders ) |
44 | |
{ |
45 | 0 | this( chunk, Arrays.asList( appenders ) ); |
46 | 0 | } |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
public MixinAppender( String chunk, List<Appender> appenders ) |
55 | |
{ |
56 | 442 | super( chunk ); |
57 | 442 | this.appenders.addAll( appenders ); |
58 | 442 | } |
59 | |
|
60 | |
@Override |
61 | |
public void doAppend( StringBuilder buffer, Map<String, String> configuration, Tree<Appender> context ) |
62 | |
{ |
63 | 6910 | for ( Appender appender : appenders ) |
64 | |
{ |
65 | 23278 | appender.append( buffer, configuration, context ); |
66 | |
} |
67 | 6910 | } |
68 | |
|
69 | |
@Override |
70 | |
public boolean equals( Object obj ) |
71 | |
{ |
72 | 44016 | if ( obj == this ) |
73 | |
{ |
74 | 0 | return true; |
75 | |
} |
76 | 44016 | if ( obj instanceof MixinAppender ) |
77 | |
{ |
78 | 690 | MixinAppender other = (MixinAppender) obj; |
79 | 690 | if ( appenders.size() == other.appenders.size() ) |
80 | |
{ |
81 | 12 | return appenders.containsAll( other.appenders ); |
82 | |
} |
83 | |
} |
84 | 44004 | return false; |
85 | |
} |
86 | |
|
87 | |
@Override |
88 | |
public int hashCode() |
89 | |
{ |
90 | 0 | return appenders.hashCode(); |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public boolean needsResolving() |
97 | |
{ |
98 | 192 | for ( Appender appender : appenders ) |
99 | |
{ |
100 | 312 | if ( appender.needsResolving() ) |
101 | |
{ |
102 | 188 | return true; |
103 | |
} |
104 | |
} |
105 | 4 | return false; |
106 | |
} |
107 | |
|
108 | |
} |