Add support for modifier within the Jaxb XMLElement annotation (#4433)

* fixes #4432 Adding support for the  modifier within the Jaxb XMLElement annotation. Updated README with JaxbAnnotations configuration option.

* #4432 Running the Petstore files
This commit is contained in:
Dan Mikita 2017-01-17 02:26:30 -05:00 committed by wing328
parent a846a571b3
commit 0a559f0dd2
7 changed files with 360 additions and 339 deletions

View File

@ -45,7 +45,8 @@ mvn clean compile
- `modelPackage` - the package to use for generated model objects/classes - `modelPackage` - the package to use for generated model objects/classes
- `apiPackage` - the package to use for generated api objects/classes - `apiPackage` - the package to use for generated api objects/classes
- `invokerPackage` - the package to use for the generated invoker objects - `invokerPackage` - the package to use for the generated invoker objects
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums. - `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums
- `useJaxbAnnotations` - enable Jaxb annotations inside the generated models
- `configOptions` - a map of language-specific parameters (see below) - `configOptions` - a map of language-specific parameters (see below)
- `configHelp` - dumps the configuration help for the specified library (generates no sources) - `configHelp` - dumps the configuration help for the specified library (generates no sources)

View File

@ -25,7 +25,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
{{>enumClass}}{{/items}}{{/items.isEnum}} {{>enumClass}}{{/items}}{{/items.isEnum}}
{{#useJaxbAnnotations}} {{#useJaxbAnnotations}}
@XmlElement(name="{{baseName}}") @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
{{/useJaxbAnnotations}} {{/useJaxbAnnotations}}
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}

View File

@ -15,6 +15,14 @@
<maven>2.2.0</maven> <maven>2.2.0</maven>
</prerequisites> </prerequisites>
<licenses>
<license>
<name>Unlicense</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r</url>
<distribution>repo</distribution>
</license>
</licenses>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -129,7 +137,6 @@
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>${jodatime-version}</version> <version>${jodatime-version}</version>
</dependency> </dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

View File

@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -56,7 +57,6 @@ public class FakeApi {
private com.squareup.okhttp.Call testCodeInjectEndRnNRCall(String testCodeInjectEndRnNR, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { private com.squareup.okhttp.Call testCodeInjectEndRnNRCall(String testCodeInjectEndRnNR, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null; Object localVarPostBody = null;
// create path and map variables // create path and map variables
String localVarPath = "/fake".replaceAll("\\{format\\}","json"); String localVarPath = "/fake".replaceAll("\\{format\\}","json");
@ -94,6 +94,19 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { }; String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call testCodeInjectEndRnNRValidateBeforeCall(String testCodeInjectEndRnNR, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = testCodeInjectEndRnNRCall(testCodeInjectEndRnNR, progressListener, progressRequestListener);
return call;
} }
/** /**
@ -114,7 +127,7 @@ public class FakeApi {
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ */
public ApiResponse<Void> testCodeInjectEndRnNRWithHttpInfo(String testCodeInjectEndRnNR) throws ApiException { public ApiResponse<Void> testCodeInjectEndRnNRWithHttpInfo(String testCodeInjectEndRnNR) throws ApiException {
com.squareup.okhttp.Call call = testCodeInjectEndRnNRCall(testCodeInjectEndRnNR, null, null); com.squareup.okhttp.Call call = testCodeInjectEndRnNRValidateBeforeCall(testCodeInjectEndRnNR, null, null);
return apiClient.execute(call); return apiClient.execute(call);
} }
@ -147,7 +160,7 @@ public class FakeApi {
}; };
} }
com.squareup.okhttp.Call call = testCodeInjectEndRnNRCall(testCodeInjectEndRnNR, progressListener, progressRequestListener); com.squareup.okhttp.Call call = testCodeInjectEndRnNRValidateBeforeCall(testCodeInjectEndRnNR, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback); apiClient.executeAsync(call, callback);
return call; return call;
} }