Class NonSerializables


  • @InternalUseOnly
    public class NonSerializables
    extends java.lang.Object
    A registry to support (de)serialization of objects (over the lifetime of the VM). It uses weak references to allow entries to be garbage-collected when no longer used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.google.common.cache.Cache<java.util.UUID,​java.lang.Object> registry  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NonSerializables()
      Prevent instantiation: util class
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object get​(java.util.UUID key)
      Retrieve the object registered with the supplied key.
      static java.util.UUID getKey​(java.lang.Object obj)
      Retrieves the registry key for the given object.
      static java.util.UUID register​(java.lang.Object obj)
      Add an object to the registry and returns the registry key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • registry

        private static final com.google.common.cache.Cache<java.util.UUID,​java.lang.Object> registry
    • Constructor Detail

      • NonSerializables

        private NonSerializables()
        Prevent instantiation: util class
    • Method Detail

      • get

        public static java.lang.Object get​(java.util.UUID key)
        Retrieve the object registered with the supplied key.
        Parameters:
        key - the key.
        Returns:
        the registered object, or null if no matching EvaluationStrategy can be found.
      • getKey

        public static java.util.UUID getKey​(java.lang.Object obj)
        Retrieves the registry key for the given object.
        Parameters:
        obj - the object for which to retrieve the registry key.
        Returns:
        the registry key with which the supplied object can be retrieved, or null if the supplied object is not in the registry.
      • register

        public static java.util.UUID register​(java.lang.Object obj)
        Add an object to the registry and returns the registry key. If the object is already present, the operation simply returns the key with which it is currently registered.
        Parameters:
        obj - the object to register
        Returns:
        the key with which the object is registered.