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.
This is a Lucene.NET EXPERIMENTAL API, use at your own risk
Inheritance
System.Object
    SetOnce<T>
  Inherited Members
      System.Object.Equals(System.Object)
    
    
      System.Object.Equals(System.Object, System.Object)
    
    
      System.Object.GetHashCode()
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
    
      System.Object.ToString()
    
  Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public sealed class SetOnce<T>
    where T : classType Parameters
| Name | Description | 
|---|---|
| T | 
Constructors
| Improve this Doc View SourceSetOnce()
A default constructor which does not set the internal object, and allows setting it by calling Set(T).
Declaration
public SetOnce()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
Declaration
public SetOnce(T obj)Parameters
| Type | Name | Description | 
|---|---|---|
| T | obj | 
Exceptions
| Type | Condition | 
|---|---|
| AlreadySetException | if called more than once | 
See Also
Methods
| Improve this Doc View SourceClone()
Declaration
public object Clone()Returns
| Type | Description | 
|---|---|
| System.Object | 
Get()
Returns the object set by Set(T).
Declaration
public T Get()Returns
| Type | Description | 
|---|---|
| T | 
Set(T)
Sets the given object. If the object has already been set, an exception is thrown.
Declaration
public void Set(T obj)Parameters
| Type | Name | Description | 
|---|---|---|
| T | obj |