01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: package org.apache.beehive.controls.runtime.generator;
20:
21: import com.sun.mirror.declaration.*;
22: import org.apache.beehive.controls.runtime.generator.apt.TwoPhaseAnnotationProcessor;
23:
24: /**
25: * The AptOperation class represents a control operation where the operation attributes
26: * are derived using APT metadata.
27: */
28: public class AptOperation extends AptMethod {
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,
36: MethodDeclaration methodDecl, TwoPhaseAnnotationProcessor ap) {
37: super (methodDecl, ap);
38: _controlIntf = controlIntf;
39: _operDecl = methodDecl;
40: }
41:
42: /**
43: * Returns the name of the static field that holds the name of this method.
44: */
45: public String getMethodField() {
46: StringBuffer sb = new StringBuffer();
47: sb.append("_");
48: sb.append(getName());
49: int methodIndex = getIndex();
50: if (methodIndex != -1)
51: sb.append(methodIndex);
52: sb.append("Method");
53: return sb.toString();
54: }
55:
56: /**
57: * Returns the AptControlInterface associated with this ControlOperation
58: */
59: public AptControlInterface getControlInterface() {
60: return _controlIntf;
61: }
62:
63: MethodDeclaration _operDecl;
64: AptControlInterface _controlIntf;
65: }
|