本文整理汇总了Java中io.swagger.models.properties.DateProperty类的典型用法代码示例。如果您正苦于以下问题:Java DateProperty类的具体用法?Java DateProperty怎么用?Java DateProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateProperty类属于io.swagger.models.properties包,在下文中一共展示了DateProperty类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initPropertyMap
import io.swagger.models.properties.DateProperty; //导入依赖的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: mapGraphValue
import io.swagger.models.properties.DateProperty; //导入依赖的package包/类
@Override
public LocalDate mapGraphValue(@NonNull DateProperty property,
@NonNull GraphEntityContext context, @NonNull ValueContext valueContext,
@NonNull SchemaMapperAdapter schemaMapperAdapter) {
String ldPathQuery =
(String) property.getVendorExtensions().get(OpenApiSpecificationExtensions.LDPATH);
if (ldPathQuery == null && isSupportedLiteral(valueContext.getValue())) {
return convertToDate(((Literal) valueContext.getValue()).calendarValue());
}
if (ldPathQuery == null) {
throw new SchemaMapperRuntimeException(
String.format("Property '%s' must have a '%s' attribute.", property.getName(),
OpenApiSpecificationExtensions.LDPATH));
}
LdPathExecutor ldPathExecutor = context.getLdPathExecutor();
Collection<Value> queryResult =
ldPathExecutor.ldPathQuery(valueContext.getValue(), ldPathQuery);
if (!property.getRequired() && queryResult.isEmpty()) {
return null;
}
Value dateValue = getSingleStatement(queryResult, ldPathQuery);
if (!isSupportedLiteral(dateValue)) {
throw new SchemaMapperRuntimeException(String.format(
"LDPath query '%s' yielded a value which is not a literal of supported type: <%s>.",
ldPathQuery, dataTypesAsString()));
}
return convertToDate(((Literal) dateValue).calendarValue());
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:37,代码来源:DateSchemaMapper.java
示例3: mapTupleValue
import io.swagger.models.properties.DateProperty; //导入依赖的package包/类
@Override
public LocalDate mapTupleValue(@NonNull DateProperty schema, @NonNull ValueContext valueContext) {
return convertToDate(
SchemaMapperUtils.castLiteralValue(valueContext.getValue()).calendarValue());
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:6,代码来源:DateSchemaMapper.java
示例4: supports
import io.swagger.models.properties.DateProperty; //导入依赖的package包/类
@Override
public boolean supports(@NonNull Property schema) {
return schema instanceof DateProperty;
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:5,代码来源:DateSchemaMapper.java
示例5: setUp
import io.swagger.models.properties.DateProperty; //导入依赖的package包/类
@Before
public void setUp() {
schemaMapper = new DateSchemaMapper();
property = new DateProperty();
when(entityBuilderContext.getLdPathExecutor()).thenReturn(ldPathExecutor);
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:DateSchemaMapperTest.java
示例6: fillProperty
import io.swagger.models.properties.DateProperty; //导入依赖的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.DateProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论