In a Java Spring API, I'm implementing GeoJson Conversion Service
to convert different types to geojson, I have GeoJsonConversionService
interface, and one implementation is FileGeoJsonConversionServiceImpl
class
First question:
should the service name indicates the "action" or the "actor", which means should it named ConversionService
or ConverterService
.
Second:
I found 2 examples of a conversion functionality, one used method overloading which is Jackson Library
, and the other used method overriding, which is ResourceHttpMessageConverter
in Jackson, you have class ObjectMapper
with different readTree
methods, based on which type you convert to json, so you had readTree(InputStream in)
and readTree(byte[] content)
and so on.
in MessageConverter
spring class, you have AbstractHttpMessageConverter
abstract class, implemented by many classes, based on the conversion type also, such as ResourceHttpMessageConverter
and StringHttpMessageConverter
, all implementations implements readInternal
function which is method overriding
so when to use method overloading over overriding?