[SPARK-4143] [SQL] Move inner class DeferredObjectAdapter to top level

The class DeferredObjectAdapter is the inner class of HiveGenericUdf, which may cause some overhead in closure ser/de-ser. Move it to top level.