/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jdbi.v3.postgres;

import java.lang.reflect.Type;
import java.sql.Types;
import java.util.Optional;

import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.argument.ArgumentFactory;
import org.jdbi.v3.core.config.ConfigRegistry;
import org.jdbi.v3.json.Json;

@Json
class JsonArgumentFactory implements ArgumentFactory {
    @Override
    public Optional<Argument> build(Type type, Object value, ConfigRegistry config) {
        if (type != String.class) {
            return Optional.empty();
        }

        return Optional.of((p, s, c) -> s.setObject(p, value, Types.OTHER));
    }
}

@@ -598,77 +598,18 @@
 ava.
-lang.reflect.Type;%0Aimport java.sql.Types;%0Aimport java.util.Optional;%0A
+sql.Types;
 %0Aimp
@@ -639,23 +639,38 @@
 gument.A
-rgument
+bstractArgumentFactory
 ;%0Aimport
@@ -696,39 +696,32 @@
 rgument.Argument
-Factory
 ;%0Aimport org.jdb
@@ -820,19 +820,58 @@
 ory 
-implements 
+extends AbstractArgumentFactory%3CString%3E %7B%0A    Json
 Argu
@@ -881,19 +881,56 @@
 tFactory
+()
  %7B%0A
+        super(Types.OTHER);%0A    %7D%0A%0A
     @Ove
@@ -944,31 +944,25 @@
    p
-ublic Optional%3C
+rotected 
 Argument
 %3E bu
@@ -961,33 +961,21 @@
 ment
-%3E
  build(
-Type type, Object
+String
  val
@@ -1015,111 +1015,15 @@
     
-if (type != String.class) %7B%0A            return Optional.empty();%0A        %7D%0A%0A        return Optional.of(
+return 
 (p, 
@@ -1065,17 +1065,16 @@
 s.OTHER)
-)
 ;%0A    %7D%0A

make use of existing abstraction