Package org.springframework.core.serializer.support

# Class SerializingConverter

java.lang.Object
org.springframework.core.serializer.support.SerializingConverter

All Implemented Interfaces:
  `Converter<Object,byte[]>`

public class SerializingConverter extends Object implements Converter<Object,byte[]>
A `Converter` that delegates to a `Serializer` to convert an object to a byte array.

Since:
  3.0.5
Author:
  Gary Russell, Mark Fisher

## Constructor Summary

Constructors
Constructor
Description
`SerializingConverter()`
Create a default `SerializingConverter` that uses standard Java serialization.
`SerializingConverter(Serializer<Object> serializer)`
Create a `SerializingConverter` that delegates to the provided `Serializer`.

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`convert(Object source)`
Serializes the source object and returns the byte array result.

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

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

### Methods inherited from interface org.springframework.core.convert.converter.Converter

`andThen`

## Constructor Details

### SerializingConverter

public SerializingConverter()
Create a default `SerializingConverter` that uses standard Java serialization.

### SerializingConverter

public SerializingConverter(Serializer<Object> serializer)
Create a `SerializingConverter` that delegates to the provided `Serializer`.

## Method Details

### convert

public byte[] convert(Object source)
Serializes the source object and returns the byte array result.

Specified by:
  `convert` in interface `Converter<Object,byte[]>`
Parameters:
  `source` - the source object to convert, which must be an instance of `S` (never `null`)
Returns:
  the converted object, which must be an instance of `T` (potentially `null`)