KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > runtime > generator > AptOperation


1 package org.apache.beehive.controls.runtime.generator;
2 /*
3  * Copyright 2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * $Header:$
18  */

19
20 import com.sun.mirror.declaration.*;
21 import org.apache.beehive.controls.runtime.generator.apt.TwoPhaseAnnotationProcessor;
22
23 /**
24  * The AptOperation class represents a control operation where the operation attributes
25  * are derived using APT metadata.
26  */

27 public class AptOperation extends AptMethod
28 {
29     /**
30      * Constructs a new ControlOperation instance where interface information is derived
31      * from APT metadata
32      * @param controlIntf the declaring ControlInterface
33      * @param methodDecl the method associated with the operation
34      */

35     public AptOperation(AptControlInterface controlIntf, MethodDeclaration methodDecl, TwoPhaseAnnotationProcessor ap)
36     {
37         super(methodDecl, ap);
38         _controlIntf = controlIntf;
39         _operDecl = methodDecl;
40     }
41
42
43     /**
44      * Returns the name of the static field that holds the name of this method.
45      */

46     public String JavaDoc getMethodField()
47     {
48         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
49         sb.append("_");
50         sb.append(getName());
51         int methodIndex = getIndex();
52         if (methodIndex != -1)
53             sb.append(methodIndex);
54         sb.append("Method");
55         return sb.toString();
56     }
57
58     /**
59      * Returns the AptControlInterface associated with this ControlOperation
60      */

61     public AptControlInterface getControlInterface() { return _controlIntf; }
62
63     MethodDeclaration _operDecl;
64     AptControlInterface _controlIntf;
65 }
66
Popular Tags