KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > parse > AbstractServiceDescriptor


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

15 package org.apache.hivemind.parse;
16
17 import java.util.ArrayList JavaDoc;
18 import java.util.List JavaDoc;
19
20 import org.apache.hivemind.util.ToStringBuilder;
21
22 /**
23  * Base class for {@link org.apache.hivemind.parse.ServicePointDescriptor} and
24  * {@link org.apache.hivemind.parse.ImplementationDescriptor}.
25  *
26  *
27  * @author Howard Lewis Ship
28  */

29 public abstract class AbstractServiceDescriptor extends BaseAnnotationHolder
30 {
31     private InstanceBuilder _instanceBuilder;
32     private List JavaDoc _interceptors;
33     
34
35     public String JavaDoc toString()
36     {
37         ToStringBuilder builder = new ToStringBuilder(this);
38
39         extendDescription(builder);
40
41         builder.append("instanceBuilder", _instanceBuilder);
42         builder.append("interceptors", _interceptors);
43
44         return builder.toString();
45     }
46     
47     /**
48      * Implemented in subclasses to provide details about the instance.
49      */

50     protected abstract void extendDescription(ToStringBuilder builder);
51
52     public InstanceBuilder getInstanceBuilder()
53     {
54         return _instanceBuilder;
55     }
56
57     /**
58      * A service extension may contribute one instance builder.
59      */

60     public void setInstanceBuilder(InstanceBuilder descriptor)
61     {
62         _instanceBuilder = descriptor;
63     }
64
65     public void addInterceptor(InterceptorDescriptor interceptor)
66     {
67         if (_interceptors == null)
68             _interceptors = new ArrayList JavaDoc();
69
70         _interceptors.add(interceptor);
71     }
72
73     /**
74      * Returns a list of {@link InterceptorDescriptor}. May
75      * return null. The caller should not modify the returned list.
76      */

77     public List JavaDoc getInterceptors()
78     {
79         return _interceptors;
80     }
81
82 }
83
Popular Tags