@@ -51,6 +51,11 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
5151
5252 public static final String USE_ABSTRACTION_FOR_FILES = "useAbstractionForFiles" ;
5353
54+ public static final String USE_JACKSON_3 = "useJackson3" ;
55+ public static final String JACKSON2_PACKAGE = "com.fasterxml.jackson" ;
56+ public static final String JACKSON3_PACKAGE = "tools.jackson" ;
57+ public static final String JACKSON_PACKAGE = "jacksonPackage" ;
58+
5459 @ Getter protected boolean useGenericResponse = false ;
5560
5661 @ Getter protected boolean useGzipFeatureForTests = false ;
@@ -59,6 +64,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen
5964
6065 @ Setter protected boolean useAbstractionForFiles = false ;
6166
67+ @ Getter @ Setter protected boolean useJackson3 = false ;
68+
6269 public JavaCXFClientCodegen () {
6370 super ();
6471
@@ -97,6 +104,8 @@ public JavaCXFClientCodegen() {
97104 cliOptions .add (CliOption .newBoolean (USE_LOGGING_FEATURE_FOR_TESTS , "Use Logging Feature for tests" ));
98105 cliOptions .add (CliOption .newBoolean (USE_GENERIC_RESPONSE , "Use generic response" ));
99106 cliOptions .add (CliOption .newBoolean (USE_ABSTRACTION_FOR_FILES , "Use alternative types instead of java.io.File to allow passing bytes without a file on disk." ));
107+ cliOptions .add (CliOption .newBoolean (USE_JACKSON_3 , "Use Jackson 3 instead of Jackson 2." , this .useJackson3 ));
108+
100109 }
101110
102111 @ Override
@@ -107,7 +116,13 @@ public void processOpts() {
107116 convertPropertyToBooleanAndWriteBack (USE_LOGGING_FEATURE_FOR_TESTS , this ::setUseLoggingFeatureForTests );
108117 convertPropertyToBooleanAndWriteBack (JACKSON , this ::setJackson );
109118 convertPropertyToBooleanAndWriteBack (USE_ABSTRACTION_FOR_FILES , this ::setUseAbstractionForFiles );
119+ convertPropertyToBooleanAndWriteBack (USE_JACKSON_3 , this ::setUseJackson3 );
110120
121+ if (this .useJackson3 ) {
122+ this .applyJackson3Package ();
123+ } else {
124+ this .applyJackson2Package ();
125+ }
111126 supportingFiles .clear (); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
112127
113128 supportingFiles .add (new SupportingFile ("pom.mustache" , "" , "pom.xml" )
@@ -206,4 +221,12 @@ public void setUseGenericResponse(boolean useGenericResponse) {
206221 this .useGenericResponse = useGenericResponse ;
207222 }
208223
224+
225+ protected void applyJackson2Package () {
226+ writePropertyBack (JACKSON_PACKAGE , JACKSON2_PACKAGE );
227+ }
228+
229+ protected void applyJackson3Package () {
230+ writePropertyBack (JACKSON_PACKAGE , JACKSON3_PACKAGE );
231+ }
209232}
0 commit comments