01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.tapestry.ioc.internal;
16:
17: import org.apache.tapestry.ioc.ObjectCreator;
18: import org.apache.tapestry.ioc.ServiceBuilderResources;
19: import org.apache.tapestry.ioc.def.ServiceDef;
20:
21: public class ServiceDefImpl implements ServiceDef {
22: private final Class _serviceInterface;
23:
24: private final String _serviceId;
25:
26: private final String _scope;
27:
28: private final boolean _eagerLoad;
29:
30: private final ObjectCreatorSource _source;
31:
32: ServiceDefImpl(Class serviceInterface, String serviceId,
33: String scope, boolean eagerLoad, ObjectCreatorSource source) {
34: _serviceInterface = serviceInterface;
35: _serviceId = serviceId;
36: _scope = scope;
37: _eagerLoad = eagerLoad;
38: _source = source;
39: }
40:
41: @Override
42: public String toString() {
43: return _source.getDescription();
44: }
45:
46: public ObjectCreator createServiceCreator(
47: ServiceBuilderResources resources) {
48: return _source.constructCreator(resources);
49: }
50:
51: public String getServiceId() {
52: return _serviceId;
53: }
54:
55: public Class getServiceInterface() {
56: return _serviceInterface;
57: }
58:
59: public String getServiceScope() {
60: return _scope;
61: }
62:
63: public boolean isEagerLoad() {
64: return _eagerLoad;
65: }
66:
67: }
|