KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > instrument > JoinpointStatusUpdate


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.aop.instrument;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Collection JavaDoc;
26
27 import javassist.CtClass;
28
29 /**
30  * This class contains the status update of
31  * all joinpoints associated to a class.
32  * @author Flavia Rainone
33  */

34 public class JoinpointStatusUpdate
35 {
36    /**
37     * The class whose joinpoints are related to this update.
38     */

39    public CtClass clazz;
40    
41    /**
42     * Joinpoints which became advised recently.
43     */

44    public ClassJoinpoints newlyAdvisedJoinpoints;
45    
46    /**
47     * Joinpoints which became unadvised recently.
48     */

49    public ClassJoinpoints newlyUnadvisedJoinpoints;
50    
51    /**
52     * Returns <code>true</code> if this object contains no joinpoints.
53     */

54    public boolean isEmpty()
55    {
56       return newlyAdvisedJoinpoints.isEmpty() && newlyUnadvisedJoinpoints.isEmpty();
57    }
58    
59    /**
60     * Collection of the joinponts of a class.
61     */

62    public static class ClassJoinpoints {
63       
64       /**
65        * The field read joinpoints.
66        * A collection of <code>java.lang.Integer</code>.
67        */

68       public Collection JavaDoc fieldReads;
69
70       /**
71        * The field write joinponts.
72        * A collection of <code>java.lang.Integer</code>.
73        */

74       public Collection JavaDoc fieldWrites;
75       
76       /**
77        * The constructor execution joinpoints.
78        * A collection of <code>java.lang.Integer</code>.
79        */

80       public Collection JavaDoc constructorExecutions;
81       
82       /**
83        * The method execution joinpoints.
84        * A collection of <code>org.jboss.aop.MethodJoinPoint</code>.
85        */

86       public Collection JavaDoc methodExecutions;
87       
88       /**
89        * Constructor.
90        * @param fields the maximum number of field reads and field writes that this
91        * instance may contain.
92        * @param constructors the maximum number of constructor executions that this
93        * instance may contain.
94        * @param methods the maximum number of method executions that this
95        * instance may contain.
96        */

97       public ClassJoinpoints(int fields, int constructors, int methods) {
98          this.fieldReads = new ArrayList JavaDoc(fields);
99          this.fieldWrites = new ArrayList JavaDoc(fields);
100          this.constructorExecutions = new ArrayList JavaDoc(constructors);
101          this.methodExecutions = new ArrayList JavaDoc(methods);
102       }
103       
104       /**
105        * Returns <code>true</code> if this object contains no joinpoints.
106        */

107       public boolean isEmpty()
108       {
109          return fieldReads.isEmpty() && fieldWrites.isEmpty() &&
110             constructorExecutions.isEmpty() && methodExecutions.isEmpty();
111       }
112    }
113 }
Popular Tags