Class AbstractLazyInitializer<T>

java.lang.Object
com.google.cloud.spanner.AbstractLazyInitializer<T>
Type Parameters:
T - Object which is to be initialized lazily
Direct Known Subclasses:
LazySpannerInitializer

public abstract class AbstractLazyInitializer<T> extends Object
Generic AbstractLazyInitializer for any heavy-weight object that might throw an exception during initialization. The underlying object is initialized at most once.
  • Constructor Details

    • AbstractLazyInitializer

      public AbstractLazyInitializer()
  • Method Details

    • get

      public T get() throws Exception
      Returns an initialized instance of T.
      Throws:
      Exception
    • initialize

      protected abstract T initialize() throws Exception
      Initializes the actual object that should be returned. Is called once the first time an instance of T is required.
      Throws:
      Exception