01: package org.drools.lang.descr;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.ArrayList;
20: import java.util.Collections;
21: import java.util.List;
22:
23: public class FunctionDescr extends BaseDescr {
24: private static final long serialVersionUID = 400L;
25:
26: private final String name;
27: private final String returnType;
28:
29: private List parameterTypes = Collections.EMPTY_LIST;
30: private List parameterNames = Collections.EMPTY_LIST;
31:
32: private String text;
33:
34: private int offset;
35:
36: private String className;
37:
38: public FunctionDescr(final String name, final String returnType) {
39: this .name = name;
40: this .returnType = returnType;
41: }
42:
43: public String getName() {
44: return this .name;
45: }
46:
47: public String getClassName() {
48: return this .className;
49: }
50:
51: public void setClassName(final String className) {
52: this .className = className;
53: }
54:
55: public List getParameterNames() {
56: return this .parameterNames;
57: }
58:
59: public List getParameterTypes() {
60: return this .parameterTypes;
61: }
62:
63: public void addParameter(final String type, final String name) {
64: if (this .parameterTypes == Collections.EMPTY_LIST) {
65: this .parameterTypes = new ArrayList();
66: }
67: this .parameterTypes.add(type);
68:
69: if (this .parameterNames == Collections.EMPTY_LIST) {
70: this .parameterNames = new ArrayList();
71: }
72: this .parameterNames.add(name);
73: }
74:
75: public String getReturnType() {
76: return this .returnType;
77: }
78:
79: public void setText(final String text) {
80: this .text = text;
81: }
82:
83: public String getText() {
84: return this .text;
85: }
86:
87: public int getOffset() {
88: return this .offset;
89: }
90:
91: public void setOffset(final int offset) {
92: this.offset = offset;
93: }
94:
95: }
|