Class CacheObjectUtils


  • public class CacheObjectUtils
    extends Object
    Cache object utility methods.
    • Method Detail

      • unwrapBinaryIfNeeded

        public static Object unwrapBinaryIfNeeded​(CacheObjectValueContext ctx,
                                                  CacheObject o,
                                                  boolean keepBinary,
                                                  boolean cpy)
        Parameters:
        o - Object to unwrap.
        keepBinary - Keep binary flag.
        cpy - Copy value flag.
        Returns:
        Unwrapped object.
      • unwrapBinaryIfNeeded

        public static Object unwrapBinaryIfNeeded​(CacheObjectValueContext ctx,
                                                  Object o,
                                                  boolean keepBinary,
                                                  boolean cpy,
                                                  @Nullable
                                                  @Nullable ClassLoader ldr)
        Parameters:
        ctx - Cache object context.
        o - Object to unwrap.
        keepBinary - Keep binary flag.
        cpy - Copy value flag.
        ldr - Class loader, used for deserialization from binary representation.
        Returns:
        Unwrapped object.
      • unwrapBinariesIfNeeded

        public static Collection<Object> unwrapBinariesIfNeeded​(CacheObjectValueContext ctx,
                                                                Collection<?> col,
                                                                boolean keepBinary)
        Parameters:
        col - Collection of objects to unwrap.
        keepBinary - Keep binary flag.
        Returns:
        Unwrapped collection.
      • unwrapBinary

        public static Object unwrapBinary​(CacheObjectValueContext ctx,
                                          Object o,
                                          boolean keepBinary,
                                          boolean cpy,
                                          @Nullable
                                          @Nullable ClassLoader ldr)
        Unwraps an object for end user.
        Parameters:
        ctx - Cache object context.
        o - Object to unwrap.
        keepBinary - False when need to deserialize object from a binary one, true otherwise.
        cpy - True means the object will be copied before return, false otherwise.
        ldr - Class loader, used for deserialization from binary representation.
        Returns:
        Unwrapped object.
      • putValue

        public static boolean putValue​(byte cacheObjType,
                                       ByteBuffer buf,
                                       int off,
                                       int len,
                                       byte[] valBytes,
                                       int start)
                                throws IgniteCheckedException
        Parameters:
        cacheObjType - Cache object type.
        buf - Buffer to write value to.
        off - Offset in source binary data.
        len - Length of the data to write.
        valBytes - Binary data.
        start - Start offset in binary data.
        Returns:
        True if data were successfully written.
        Throws:
        IgniteCheckedException - If failed.