Class Lazy.Default<T>

java.lang.Object
one.microstream.reference.Lazy.Default<T>
All Implemented Interfaces:
Lazy<T>, Referencing<T>
Direct Known Subclasses:
ControlledLazyReference.Default
Enclosing interface:
Lazy<T>

public static class Lazy.Default<T>
extends Object
implements Lazy<T>
  • Method Details

    • genericType

      public static final Class<Lazy.Default<?>> genericType()
    • objectId

      public final long objectId()
    • lastTouched

      public final long lastTouched()
      Description copied from interface: Lazy
      Returns the timestamp (corresponding to System.currentTimeMillis()) when this instance has last been "touched", meaning having its reference modified or queried.
      Specified by:
      lastTouched in interface Lazy<T>
      Returns:
      the time this instance has last been significantly used.
    • isStored

      public final boolean isStored()
      Description copied from interface: Lazy
      Returns if this lazy reference was persisted before.
      Specified by:
      isStored in interface Lazy<T>
      Returns:
      true if this lazy reference was persisted, false otherwise
    • isLoaded

      public final boolean isLoaded()
      Description copied from interface: Lazy
      Returns if this lazy reference is loaded. There are three cases in which this applies:
      • It is not yet persisted, meaning it is implicitly always "loaded".
      • A null-reference is always "loaded".
      • Otherwise, the subject must be present, truly a state of having been "loaded".
      Specified by:
      isLoaded in interface Lazy<T>
      Returns:
      true if this lazy reference is loaded, false otherwise
    • peek

      public final T peek()
      Description copied from interface: Lazy
      Returns the local reference without loading the referenced object if it is not present. The value returned by Lazy.lastTouched() will not be changed by calling this method.
      Specified by:
      peek in interface Lazy<T>
      Returns:
      the currently present reference.
    • clear

      public T clear()
      Description copied from interface: Lazy
      Clears the reference, leaving the option to re-load it again intact, and returns the subject that was referenced prior to clearing.
      Specified by:
      clear in interface Lazy<T>
      Returns:
      the subject referenced prior to clearing the reference.
      See Also:
      Lazy.clear(ClearingEvaluator)
    • clear

      public boolean clear​(Lazy.ClearingEvaluator clearingEvaluator)
      Description copied from interface: Lazy
      Clears the reference if the clearingEvaluator decides to, leaving the option to re-load it again intact, and returns the subject that was referenced prior to clearing.
      Specified by:
      clear in interface Lazy<T>
      Parameters:
      clearingEvaluator - evaluator which decides if the reference should be cleared
      Returns:
      if this lazy references was cleared
      See Also:
      Lazy.clear()
    • $link

      public final void $link​(long objectId, ObjectSwizzling loader)
    • $unlink

      public final void $unlink()
    • $setLoader

      public final void $setLoader​(ObjectSwizzling loader)
    • get

      public final T get()
      Description copied from interface: Lazy
      Returns the original subject referenced by this reference instance. If the subject has (lazily) not been loaded, an attempt to do so now is made. Any exception occurring during the loading attempt will be passed along without corrupting this reference instance's internal state.
      Specified by:
      get in interface Lazy<T>
      Specified by:
      get in interface Referencing<T>
      Returns:
      the originally referenced subject, either already-known or lazy-loaded.
    • toString

      public String toString()
      Overrides:
      toString in class Object