Class SetOnce<T>
A convenient class which offers a semi-immutable object wrapper implementation which allows one to set the value of an object exactly once, and retrieve it many times. If Set(T) is called more than once, AlreadySetException is thrown and the operation will fail.
@lucene.experimental
Inheritance
System.Object
SetOnce<T>
Assembly: DistributedLucene.Net.dll
Syntax
public sealed class SetOnce<T> : object where T : class
Type Parameters
Name | Description |
---|---|
T |
Constructors
Name | Description |
---|---|
SetOnce() | A default constructor which does not set the internal object, and allows setting it by calling Set(T). |
SetOnce(T) | Creates a new instance with the internal object set to the given object. Note that any calls to Set(T) afterwards will result in AlreadySetException |
Methods
Name | Description |
---|---|
Clone() | |
Get() | Returns the object set by Set(T). |
Set(T) | Sets the given object. If the object has already been set, an exception is thrown. |