Package javax.cache.configuration
Class FactoryBuilder.SingletonFactory<T>
- java.lang.Object
-
- javax.cache.configuration.FactoryBuilder.SingletonFactory<T>
-
- Type Parameters:
T
- the type of the instance produced by theFactory
- All Implemented Interfaces:
java.io.Serializable
,Factory<T>
- Enclosing class:
- FactoryBuilder
public static class FactoryBuilder.SingletonFactory<T> extends java.lang.Object implements Factory<T>, java.io.Serializable
AFactory
that always returns a specific instance. ie: the factory returns a singleton, regardless of the number of timesFactory.create()
is called.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private T
instance
The singleton instance.static long
serialVersionUID
The serialVersionUID required forSerializable
.
-
Constructor Summary
Constructors Constructor Description SingletonFactory(T instance)
Constructor for theFactoryBuilder.SingletonFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
create()
Constructs and returns a fully configured instance of T.boolean
equals(java.lang.Object other)
int
hashCode()
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
The serialVersionUID required forSerializable
.- See Also:
- Constant Field Values
-
instance
private T instance
The singleton instance.
-
-
Constructor Detail
-
SingletonFactory
public SingletonFactory(T instance)
Constructor for theFactoryBuilder.SingletonFactory
.- Parameters:
instance
- the instance to return
-
-
Method Detail
-
create
public T create()
Description copied from interface:Factory
Constructs and returns a fully configured instance of T.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-