org.apache.ignite.internal.portable

## Class PortableUtils

- java.lang.Object
- - org.apache.ignite.internal.portable.PortableUtils

    public class PortableUtils
    extends Object

### Field Summary

Fields
`static Map<Byte,Class<?>>` `FLAG_TO_CLASS`
`static Map<Class<?>,Byte>` `PLAIN_CLASS_TO_FLAG`

### Constructor Summary

Constructors
Constructor and Description
`PortableUtils()`

### Method Summary

Methods
`static boolean` `isPlainArrayType(int type)` Checks whether an array type values can or can not contain references to other object.
`static boolean` `isPlainType(int type)`
`static boolean` `isPortableOrCollectionType(Class<?> cls)` Tells whether provided type is portable or a collection.
`static boolean` `isPortableType(Class<?> cls)` Tells whether provided type is portable.
`static <K,V> Map<K,V>` `newMap(Map<K,V> map)` Attempts to create a new map of the same type as `map` has.
`static <V> Set<V>` `newSet(Set<V> set)` Attempts to create a new set of the same type as `set` has.
`static byte` `typeByClass(Class<?> cls)`
`static Object` `unwrapLazy(Object obj)`
`static Iterator<Object>` `unwrapLazyIterator(Iterator<Object> delegate)`
`static void` `writePlainObject(PortableWriterExImpl writer, Object val)` Write value with flag. e.g. writePlainObject(writer, (byte)77) will write two byte: {BYTE, 77}.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### PLAIN_CLASS_TO_FLAG

    public static final Map<Class<?>,Byte> PLAIN_CLASS_TO_FLAG

#### FLAG_TO_CLASS

    public static final Map<Byte,Class<?>> FLAG_TO_CLASS

### Constructor Detail

#### PortableUtils

    public PortableUtils()

### Method Detail

#### writePlainObject

    public static void writePlainObject(PortableWriterExImpl writer,
                        Object val)

Write value with flag. e.g. writePlainObject(writer, (byte)77) will write two byte: {BYTE, 77}.

Parameters:
  `writer` - W
  `val` - Value.

#### unwrapLazy

    public static Object unwrapLazy(@Nullable
                    Object obj)

Parameters:
  `obj` - Value to unwrap.
Returns:
  Unwrapped value.

#### unwrapLazyIterator

    public static Iterator<Object> unwrapLazyIterator(Iterator<Object> delegate)

Parameters:
  `delegate` - Iterator to delegate.
Returns:
  New iterator.

#### isPlainType

    public static boolean isPlainType(int type)

Returns:
  `true` if content of serialized value cannot contain references to other object.

#### isPlainArrayType

    public static boolean isPlainArrayType(int type)

Checks whether an array type values can or can not contain references to other object.

Parameters:
  `type` - Array type.
Returns:
  `true` if content of serialized array value cannot contain references to other object.

#### typeByClass

    public static byte typeByClass(Class<?> cls)

Parameters:
  `cls` - Class.
Returns:
  Portable field type.

#### isPortableOrCollectionType

    public static boolean isPortableOrCollectionType(Class<?> cls)

Tells whether provided type is portable or a collection.

Parameters:
  `cls` - Class to check.
Returns:
  Whether type is portable or a collection.

#### isPortableType

    public static boolean isPortableType(Class<?> cls)

Tells whether provided type is portable.

Parameters:
  `cls` - Class to check.
Returns:
  Whether type is portable.

#### newMap

    public static <K,V> Map<K,V> newMap(Map<K,V> map)

Attempts to create a new map of the same type as `map` has. Otherwise returns new `HashMap` instance.

Parameters:
  `map` - Original map.
Returns:
  New map.

#### newSet

    public static <V> Set<V> newSet(Set<V> set)

Attempts to create a new set of the same type as `set` has. Otherwise returns new `HashSet` instance.

Parameters:
  `set` - Original set.
Returns:
  New set.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015