KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > config > InstrumentationDescriptorImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.config;
5
6 import com.tc.aspectwerkz.reflect.ClassInfo;
7 import com.tc.object.config.schema.InstrumentedClass;
8
9 final class InstrumentationDescriptorImpl implements InstrumentationDescriptor {
10   private final InstrumentedClass classDescriptor;
11   private final ClassExpressionMatcher expressionMatcher;
12
13   public InstrumentationDescriptorImpl(InstrumentedClass classDescriptor, ClassExpressionMatcher expressionMatcher) {
14     this.classDescriptor = classDescriptor;
15     this.expressionMatcher = expressionMatcher;
16   }
17
18   public String JavaDoc getOnLoadMethodIfDefined() {
19     if (isExclude()) { return null; }
20     return classDescriptor.onLoad().isCallMethodOnLoadType() ? classDescriptor.onLoad().getMethod() : null;
21   }
22
23   public String JavaDoc getOnLoadScriptIfDefined() {
24     if (isExclude()) { return null; }
25     return classDescriptor.onLoad().isExecuteScriptOnLoadType() ? classDescriptor.onLoad().getExecuteScript() : null;
26   }
27
28   public boolean isCallConstructorOnLoad() {
29     return isExclude() ? false : classDescriptor.onLoad().isCallConstructorOnLoad();
30   }
31
32   public boolean isHonorTransient() {
33     return isExclude() ? false : classDescriptor.honorTransient();
34   }
35   
36   public boolean isHonorVolatile() {
37     return isExclude() ? false : classDescriptor.honorVolatile();
38   }
39
40   public boolean matches(ClassInfo classInfo) {
41     return expressionMatcher.match(classInfo);
42   }
43
44   public boolean isInclude() {
45     return classDescriptor.isInclude();
46   }
47
48   public boolean isExclude() {
49     return !isInclude();
50   }
51
52   public String JavaDoc toString() {
53     return "InstrumentationDescriptorImpl[" + classDescriptor.classExpression() + "]";
54   }
55
56 }
57
Popular Tags