本文整理汇总了Java中io.swagger.models.properties.DateTimeProperty类的典型用法代码示例。如果您正苦于以下问题:Java DateTimeProperty类的具体用法?Java DateTimeProperty怎么用?Java DateTimeProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateTimeProperty类属于io.swagger.models.properties包,在下文中一共展示了DateTimeProperty类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initPropertyMap
import io.swagger.models.properties.DateTimeProperty; //导入依赖的package包/类
private static void initPropertyMap() {
PROPERTY_MAP.put(BooleanProperty.class, SimpleType.constructUnsafe(Boolean.class));
PROPERTY_MAP.put(FloatProperty.class, SimpleType.constructUnsafe(Float.class));
PROPERTY_MAP.put(DoubleProperty.class, SimpleType.constructUnsafe(Double.class));
PROPERTY_MAP.put(DecimalProperty.class, SimpleType.constructUnsafe(BigDecimal.class));
PROPERTY_MAP.put(ByteProperty.class, SimpleType.constructUnsafe(Byte.class));
PROPERTY_MAP.put(ShortProperty.class, SimpleType.constructUnsafe(Short.class));
PROPERTY_MAP.put(IntegerProperty.class, SimpleType.constructUnsafe(Integer.class));
PROPERTY_MAP.put(BaseIntegerProperty.class, SimpleType.constructUnsafe(Integer.class));
PROPERTY_MAP.put(LongProperty.class, SimpleType.constructUnsafe(Long.class));
// stringProperty包含了enum的场景,并不一定是转化为string
// 但是,如果统一走StringPropertyConverter则可以处理enum的场景
PROPERTY_MAP.put(StringProperty.class, SimpleType.constructUnsafe(String.class));
PROPERTY_MAP.put(DateProperty.class, SimpleType.constructUnsafe(LocalDate.class));
PROPERTY_MAP.put(DateTimeProperty.class, SimpleType.constructUnsafe(Date.class));
PROPERTY_MAP.put(ByteArrayProperty.class, SimpleType.constructUnsafe(byte[].class));
PROPERTY_MAP.put(FileProperty.class, SimpleType.constructUnsafe(Part.class));
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:25,代码来源:ConverterMgr.java
示例2: makeProperty
import io.swagger.models.properties.DateTimeProperty; //导入依赖的package包/类
private Property makeProperty(PropertyDescription pd) {
switch (pd.typeName) {
case BOOLEAN:
return new BooleanProperty();
case BYTES:
return new BinaryProperty();
case COLLECTION:
return new ArrayProperty(makeProperty(pd.elementDescription));
case DATE:
return new DateTimeProperty();
case DOUBLE:
return new DoubleProperty();
case ENUM:
StringProperty prop = new StringProperty();
if (pd.enumValues != null) {
prop._enum(Arrays.asList(pd.enumValues));
}
return prop;
case InternetAddressV4:
return new StringProperty();
case InternetAddressV6:
return new StringProperty();
case LONG:
return new LongProperty();
case MAP:
return new MapProperty(new StringProperty());
case PODO:
return refProperty(pd);
case STRING:
return new StringProperty();
case URI:
return new StringProperty(Format.URI);
default:
throw new IllegalStateException("unknown type " + pd.typeName);
}
}
开发者ID:vmware,项目名称:xenon-utils,代码行数:37,代码来源:ModelRegistry.java
示例3: fillProperty
import io.swagger.models.properties.DateTimeProperty; //导入依赖的package包/类
public static Object fillProperty(Swagger swagger, RandomGenerator gen, Property property) {
switch (property.getType()) {
case "string":
if (property instanceof StringProperty) {
StringProperty stringProp = (StringProperty) property;
if (stringProp.getEnum() != null && !stringProp.getEnum().isEmpty()) {
return gen.getValue(stringProp.getEnum());
} else {
return FormatGenerator.getString(gen, stringProp.getFormat(),
(stringProp.getMinLength() != null ? stringProp.getMinLength() : 1),
(stringProp.getMaxLength() != null ? stringProp.getMaxLength() : 25));
}
} else if (property instanceof DateTimeProperty) {
DateTimeProperty dateTimeProp = (DateTimeProperty) property;
if (dateTimeProp.getEnum() != null && !dateTimeProp.getEnum().isEmpty()) {
return gen.getValue(dateTimeProp.getEnum());
} else {
return FormatGenerator.getString(gen, dateTimeProp.getFormat(), 0, 0);
}
} else if (property instanceof DateProperty) {
DateProperty dateProp = (DateProperty) property;
if (dateProp.getEnum() != null && !dateProp.getEnum().isEmpty()) {
return gen.getValue(dateProp.getEnum());
} else {
return FormatGenerator.getString(gen, dateProp.getFormat(), 0, 0);
}
} else {
throw new RuntimeException(
"This String format is not supported : " + property.getClass().getSimpleName());
}
case "integer":
BaseIntegerProperty intProp = (BaseIntegerProperty) property;
return FormatGenerator.getInteger(gen, intProp.getFormat(),
(intProp.getMinimum() != null ? intProp.getMinimum().intValue() : Integer.MIN_VALUE),
(intProp.getMaximum() != null ? intProp.getMaximum().intValue() : Integer.MAX_VALUE));
case "number":
DecimalProperty numberProp = (DecimalProperty) property;
return FormatGenerator.getNumber(gen, numberProp.getFormat(),
(numberProp.getMinimum() != null ? numberProp.getMinimum() : Double.MIN_VALUE),
(numberProp.getMaximum() != null ? numberProp.getMaximum() : Double.MAX_VALUE));
case "boolean":
return FormatGenerator.getBoolean(gen);
case "ref":
return getRef(swagger, gen, (RefProperty) property);
case "array":
return getArray(swagger, gen, (ArrayProperty) property);
default:
throw new RuntimeException("This type is not supported.");
}
}
开发者ID:lpelleau,项目名称:SwagTester,代码行数:51,代码来源:BodyGenerator.java
注:本文中的io.swagger.models.properties.DateTimeProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论