Interface Converter
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
FreqMapConverter,HyperLogLogPlusConverter,UnionConverter
public interface Converter extends Serializable
An instance of this interface is used to convert an instance of a particular class into an object who's class matches a particular SparkDataType.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanHandle(Class clazz)Enables checking whether the converter can convert a particular class.Objectconvert(Object object)Request that the Serialisation serialises some object and returns the raw bytes of the serialised form.org.apache.spark.sql.types.DataTypeconvertedType()Returns theDataTypeindicating the type of the object that results from the conversion.
-
-
-
Method Detail
-
canHandle
boolean canHandle(Class clazz)
Enables checking whether the converter can convert a particular class.- Parameters:
clazz- the class of the object to convert- Returns:
- boolean true if it can be handled
-
convertedType
org.apache.spark.sql.types.DataType convertedType()
Returns theDataTypeindicating the type of the object that results from the conversion.- Returns:
- DataType the
DataTypecorresponding to the class that the object will be converted to.
-
convert
Object convert(Object object) throws ConversionException
Request that the Serialisation serialises some object and returns the raw bytes of the serialised form.- Parameters:
object- the object to be serialised- Returns:
- Object the converted object
- Throws:
ConversionException- if the conversion of the object fails
-
-