Show / Hide Table of Contents

    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 : class
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    SetOnce()

    A default constructor which does not set the internal object, and allows setting it by calling Set(T).

    Declaration
    public SetOnce()
    | Improve this Doc View Source

    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
    Set(T)

    Methods

    | Improve this Doc View Source

    Clone()

    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    Get()

    Returns the object set by Set(T).

    Declaration
    public T Get()
    Returns
    Type Description
    T
    | Improve this Doc View Source

    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

    Extension Methods

    Number.IsNumber(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)