blob: 9f46357086941914ba7a983df0787ceae07caf07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package org.apache.tuscany.core.injection;
import org.apache.tuscany.core.builder.ObjectFactory;
/**
* Implementation of ObjectFactory that returns a single instance, typically an immutable type.
*
* @version $Rev$ $Date$
*/
public class SingletonObjectFactory<T> implements ObjectFactory<T> {
private final T instance;
// ----------------------------------
// Constructors
// ----------------------------------
public SingletonObjectFactory(T instance) {
this.instance = instance;
}
// ----------------------------------
// Methods
// ----------------------------------
public T getInstance() {
return instance;
}
}
|