io.swagger.models.properties.BaseIntegerProperty Java Examples
The following examples show how to use
io.swagger.models.properties.BaseIntegerProperty.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConverterMgr.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
private static void initPropertyMap() { PROPERTY_MAP.put(BooleanProperty.class, TypeFactory.defaultInstance().constructType(Boolean.class)); PROPERTY_MAP.put(FloatProperty.class, TypeFactory.defaultInstance().constructType(Float.class)); PROPERTY_MAP.put(DoubleProperty.class, TypeFactory.defaultInstance().constructType(Double.class)); PROPERTY_MAP.put(DecimalProperty.class, TypeFactory.defaultInstance().constructType(BigDecimal.class)); PROPERTY_MAP.put(ByteProperty.class, TypeFactory.defaultInstance().constructType(Byte.class)); PROPERTY_MAP.put(ShortProperty.class, TypeFactory.defaultInstance().constructType(Short.class)); PROPERTY_MAP.put(IntegerProperty.class, TypeFactory.defaultInstance().constructType(Integer.class)); PROPERTY_MAP.put(BaseIntegerProperty.class, TypeFactory.defaultInstance().constructType(Integer.class)); PROPERTY_MAP.put(LongProperty.class, TypeFactory.defaultInstance().constructType(Long.class)); // stringProperty include enum scenes, not always be string type // if convert by StringPropertyConverter, can support enum scenes PROPERTY_MAP.put(StringProperty.class, TypeFactory.defaultInstance().constructType(String.class)); PROPERTY_MAP.put(DateProperty.class, TypeFactory.defaultInstance().constructType(LocalDate.class)); PROPERTY_MAP.put(DateTimeProperty.class, TypeFactory.defaultInstance().constructType(Date.class)); PROPERTY_MAP.put(ByteArrayProperty.class, TypeFactory.defaultInstance().constructType(byte[].class)); PROPERTY_MAP.put(FileProperty.class, TypeFactory.defaultInstance().constructType(Part.class)); }
Example #2
Source File: XmlExampleGenerator.java From TypeScript-Microservices with MIT License | 5 votes |
/** * Get the example string value for the given Property. * * If an example value was not provided in the specification, a default will be generated. * * @param property Property to get example string for * * @return Example String */ protected String getExample(Property property) { if (property.getExample() != null) { return property.getExample().toString(); } else if (property instanceof DateTimeProperty) { return "2000-01-23T04:56:07.000Z"; } else if (property instanceof DateProperty) { return "2000-01-23"; } else if (property instanceof BooleanProperty) { return "true"; } else if (property instanceof LongProperty) { return "123456789"; } else if (property instanceof DoubleProperty) { // derived from DecimalProperty so make sure this is first return "3.149"; } else if (property instanceof DecimalProperty) { return "1.3579"; } else if (property instanceof PasswordProperty) { return "********"; } else if (property instanceof UUIDProperty) { return "046b6c7f-0b8a-43b9-b35d-6489e6daee91"; // do these last in case the specific types above are derived from these classes } else if (property instanceof StringProperty) { return "aeiou"; } else if (property instanceof BaseIntegerProperty) { return "123"; } else if (property instanceof AbstractNumericProperty) { return "1.23"; } LOGGER.warn("default example value not implemented for " + property); return ""; }
Example #3
Source File: PropertyAdapter.java From swagger2markup with Apache License 2.0 | 5 votes |
/** * Retrieves the minimum value of a property * * @return the minimum value of the property */ public Optional<BigDecimal> getMin() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMinimum()); } return Optional.empty(); }
Example #4
Source File: PropertyAdapter.java From swagger2markup with Apache License 2.0 | 5 votes |
/** * Retrieves the minimum value of a property * * @return the minimum value of the property */ public Optional<BigDecimal> getMax() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMaximum() != null ? integerProperty.getMaximum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMaximum()); } return Optional.empty(); }