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
AFactorythat 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 TinstanceThe singleton instance.static longserialVersionUIDThe 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 Tcreate()Constructs and returns a fully configured instance of T.booleanequals(java.lang.Object other)inthashCode()
-
-
-
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:FactoryConstructs and returns a fully configured instance of T.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-