Skip to content

Commit

Permalink
Minor style and typo fixes for inclusionLevel PR
Browse files Browse the repository at this point in the history
  • Loading branch information
joelittlejohn committed Feb 5, 2017
1 parent ad0c83d commit c51df3a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {
private String timeType = null;

private String dateType = null;

private boolean formatDateTimes = false;


Expand Down Expand Up @@ -423,7 +423,7 @@ public void setAnnotationStyle(AnnotationStyle annotationStyle) {
* Sets the 'inclusionLevel' property of this class
*
* @param inclusionLevel
* The level of inclusion for Jackson2 and Jackson2 serializer.
* The level of inclusion for Jackson1 and Jackson2 serializer.
*/
public void setInclusionLevel(InclusionLevel inclusionLevel) {
this.inclusionLevel = inclusionLevel;
Expand Down Expand Up @@ -683,13 +683,13 @@ public void setTargetVersion(String targetVersion) {
public void setIncludeDynamicAccessors(boolean includeDynamicAccessors) {
this.includeDynamicAccessors = includeDynamicAccessors;
}

/**
* Sets the 'formatDateTimes' property of this class
*
* @param formatDateTimes
* Whether the fields of type <code>date-type</code> have the <code>@JsonFormat</code> annotation
* with pattern set to the default value of <code>yyyy-MM-dd'T'HH:mm:ss.SSS</code>
* Whether the fields of type <code>date-type</code> have the <code>@JsonFormat</code> annotation
* with pattern set to the default value of <code>yyyy-MM-dd'T'HH:mm:ss.SSS</code>
* and timezone set to default value of `UTC`
*/
public void setFormatDateTime(boolean formatDateTimes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public enum InclusionLevel {
ALWAYS,

/**
* Value that indicates that properties are included unless their value is: null "absent" value of a referential
* type (like Java 8 `Optional`, or {link java.utl.concurrent.atomic.AtomicReference}); that is, something that
* would not deference to a non-null value.
* Value that indicates that properties are included unless their value is:
* <ul>
* <li>null
* <li>"absent" value of a referential type (like Java 8 `Optional`, or
* {link java.utl.concurrent.atomic.AtomicReference}); that is, something
* that would not deference to a non-null value.
* </ul>
* Valid only for jackson2, for Jackson1 NON_NUL is used.
*/
NON_ABSENT,
Expand All @@ -57,8 +61,9 @@ public enum InclusionLevel {
NON_NULL,

/**
* Pseudo-value used to indicate that the higher-level defaults make sense, to avoid overriding inclusion value.
* Valid only for jackson2, for Jackson1 NON_NUL is used.
* Pseudo-value used to indicate that the higher-level defaults make sense,
* to avoid overriding inclusion value. Valid only for jackson2, for
* Jackson1 NON_NULL is used.
*/
USE_DEFAULTS,
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,19 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
private String annotationStyle = "jackson2";

/**
* The Level of inclusion to set in the generated Java types for Jackson1 and Jackson2 serializers.
* <p>
* Supported values
* <ul>
* <li><code>ALWAYS</code></li>
* <li><code>NON_ABSENT</code></li>
* <li><code>NON_DEFAULT</code></li>
* <li><code>NON_EMPTY</code></li>
* <li><code>NON_NULL</code></li>
* <li><code>USE_DEFAULTS</code></li>
* </ul>
* </p>
* The Level of inclusion to set in the generated Java types for Jackson1
* and Jackson2 serializers.
* <p>
* Supported values
* <ul>
* <li><code>ALWAYS</code></li>
* <li><code>NON_ABSENT</code></li>
* <li><code>NON_DEFAULT</code></li>
* <li><code>NON_EMPTY</code></li>
* <li><code>NON_NULL</code></li>
* <li><code>USE_DEFAULTS</code></li>
* </ul>
* </p>
*
* @parameter expression="${jsonschema2pojo.inclusionLevel}"
* default-value="NON_NULL"
Expand Down Expand Up @@ -310,6 +311,7 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* Whether to include
* <a href="http://jcp.org/en/jsr/detail?id=305">JSR-305</a> annotations
* (for schema rules like Nullable, NonNull, etc) in generated Java types.
*
* @since 0.4.8
*/
private boolean includeJsr305Annotations = false;
Expand Down Expand Up @@ -350,7 +352,8 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* The character encoding that should be used when writing the generated
* Java source files.
*
* @parameter expression="${jsonschema2pojo.outputEncoding}" default-value="UTF-8"
* @parameter expression="${jsonschema2pojo.outputEncoding}"
* default-value="UTF-8"
* @since 0.4.0
*/
private String outputEncoding = "UTF-8";
Expand All @@ -360,7 +363,8 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* {@link java.util.Date} when adding date type fields to generated Java
* types.
*
* @parameter expression="${jsonschema2pojo.useJodaDates}" default-value="false"
* @parameter expression="${jsonschema2pojo.useJodaDates}"
* default-value="false"
* @since 0.4.0
*/
private boolean useJodaDates = false;
Expand Down Expand Up @@ -428,7 +432,8 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* **EXPERIMENTAL** Whether to make the generated types 'parcelable' (for
* Android development).
*
* @parameter expression="${jsonschema2pojo.parcelable}" default-value="false"
* @parameter expression="${jsonschema2pojo.parcelable}"
* default-value="false"
* @since 0.4.11
*/
private boolean parcelable = false;
Expand Down Expand Up @@ -460,9 +465,9 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
private String[] includes;

/**
* List of file patterns to exclude. This only applies to the initial scan of
* the file system and will not prevent inclusion through a "$ref" in one of the
* schemas.
* List of file patterns to exclude. This only applies to the initial scan
* of the file system and will not prevent inclusion through a "$ref" in one
* of the schemas.
*
* @parameter
* @since 0.4.3
Expand Down Expand Up @@ -539,14 +544,14 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
/**
* The target version for generated source files.
*
* @parameter expression="${maven.compiler.target}"
* default-value="1.6"
* @parameter expression="${maven.compiler.target}" default-value="1.6"
* @since 0.4.17
*/
private String targetVersion = "1.6";

/**
* Whether to include dynamic getters, setters, and builders or to omit these methods.
* Whether to include dynamic getters, setters, and builders or to omit
* these methods.
*
* @parameter expression="${jsonschema2pojo.includeDynamicAccessors}"
* default-value="false"
Expand All @@ -562,11 +567,11 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* @readonly
*/
private MavenProject project;

/**
* Whether the fields of type `date-time` have the `@JsonFormat` annotation
* with pattern set to the default value of `yyyy-MM-dd'T'HH:mm:ss.SSS`
* and timezone set to default value of `UTC`
* Whether the fields of type `date-time` have the `@JsonFormat` annotation
* with pattern set to the default value of `yyyy-MM-dd'T'HH:mm:ss.SSS` and
* timezone set to default value of `UTC`
*
* @parameter expression="${jsonschema2pojo.formatDateTimes}"
* default-value="false"
Expand Down Expand Up @@ -726,7 +731,9 @@ public AnnotationStyle getAnnotationStyle() {
}

@Override
public InclusionLevel getInclusionLevel() { return InclusionLevel.valueOf(inclusionLevel.toUpperCase()); }
public InclusionLevel getInclusionLevel() {
return InclusionLevel.valueOf(inclusionLevel.toUpperCase());
}

@Override
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -904,9 +911,9 @@ public boolean isUseBigDecimals() {
return useBigDecimals;
}

@Override
public boolean isFormatDateTimes() {
return formatDateTimes;
}
@Override
public boolean isFormatDateTimes() {
return formatDateTimes;
}

}

0 comments on commit c51df3a

Please sign in to comment.