Package io.microsphere.convert
Class ObjectToByteArrayConverter
- java.lang.Object
-
- io.microsphere.convert.AbstractConverter<java.lang.Object,byte[]>
-
- io.microsphere.convert.ObjectToByteArrayConverter
-
- All Implemented Interfaces:
Converter<java.lang.Object,byte[]>
,Prioritized
,java.lang.Comparable<Prioritized>
public class ObjectToByteArrayConverter extends AbstractConverter<java.lang.Object,byte[]>
The class coverts theObject
instance to bebyte array
object.- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
Serializable
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectToByteArrayConverter
INSTANCE
Singleton instance ofObjectToByteArrayConverter
-
Fields inherited from class io.microsphere.convert.AbstractConverter
logger
-
Fields inherited from interface io.microsphere.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ObjectToByteArrayConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
doConvert(java.lang.Object source)
Converts the non-null source-typed value to the target-typed value.-
Methods inherited from class io.microsphere.convert.AbstractConverter
convert, equals, getPriority, hashCode, resolvePriority
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.microsphere.convert.Converter
accept, getSourceType, getTargetType
-
Methods inherited from interface io.microsphere.lang.Prioritized
compareTo
-
-
-
-
Field Detail
-
INSTANCE
public static final ObjectToByteArrayConverter INSTANCE
Singleton instance ofObjectToByteArrayConverter
-
-
Method Detail
-
doConvert
protected byte[] doConvert(java.lang.Object source) throws java.lang.Throwable
Description copied from class:AbstractConverter
Converts the non-null source-typed value to the target-typed value.This method is called by
AbstractConverter.convert(Object)
after checking if the source is null. Subclasses must implement this method to provide the actual conversion logic.- Specified by:
doConvert
in classAbstractConverter<java.lang.Object,byte[]>
- Parameters:
source
- the non-null source-typed value- Returns:
- the converted target-typed value, or
null
if conversion is not possible - Throws:
java.lang.Throwable
- if an error occurs during conversion
-
-