io.swagger.models.properties.BaseIntegerProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swagger-all Show documentation
Show all versions of swagger-all Show documentation
swagger-all is a rebundled verison of Swagger as one OSGi bundle.
The newest version!
package io.swagger.models.properties;
/**
* The BaseIntegerProperty
class defines property for integers without specific format, or with a custom
* format.
*/
public class BaseIntegerProperty extends AbstractNumericProperty {
public static final String TYPE = "integer";
public BaseIntegerProperty() {
this(null);
}
public BaseIntegerProperty(String format) {
super.type = TYPE;
super.format = format;
}
public static boolean isType(String type, String format) {
return TYPE.equals(type);
}
@Override
public void setExample(Object example) {
if (example instanceof String) {
try {
this.example = Long.parseLong((String)example);
} catch (NumberFormatException e) {
this.example = example;
}
} else {
this.example = example;
}
}
}