当前位置: 首页>>代码示例>>Java>>正文


Java IntegerProperty类代码示例

本文整理汇总了Java中io.swagger.models.properties.IntegerProperty的典型用法代码示例。如果您正苦于以下问题:Java IntegerProperty类的具体用法?Java IntegerProperty怎么用?Java IntegerProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntegerProperty类属于io.swagger.models.properties包,在下文中一共展示了IntegerProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initPropertyMap

import io.swagger.models.properties.IntegerProperty; //导入依赖的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: map_Returns_SchemaMapperAdapterResult

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void map_Returns_SchemaMapperAdapterResult() {
  // Arrange
  IntegerProperty schema = new IntegerProperty();
  GraphEntity entity =
      new GraphEntity(ImmutableMap.of(MediaType.TEXT_PLAIN_TYPE, schema), contextMock);

  Object object = new Object();
  when(schemaMapperAdapterMock.mapGraphValue(any(IntegerProperty.class),
      any(GraphEntityContext.class), any(ValueContext.class),
      any(SchemaMapperAdapter.class))).thenReturn(object);

  // Act
  Object result = entityMapper.map(entity, MediaType.TEXT_PLAIN_TYPE);

  // Assert
  assertThat(result, sameInstance(object));
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:19,代码来源:GraphEntityMapperTest.java

示例3: getSwaggerArrayProperty

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
private static Property getSwaggerArrayProperty(TypeToken<?> typeToken) {
  Class<?> type = typeToken.getRawType();
  if (type == String.class) {
    return new StringProperty();
  } else if (type == Boolean.class || type == Boolean.TYPE) {
    return new BooleanProperty();
  } else if (type == Integer.class || type == Integer.TYPE) {
    return new IntegerProperty();
  } else if (type == Long.class || type == Long.TYPE) {
    return new LongProperty();
  } else if (type == Float.class || type == Float.TYPE) {
    return new FloatProperty();
  } else if (type == Double.class || type == Double.TYPE) {
    return new DoubleProperty();
  } else if (type == byte[].class) {
    return new ByteArrayProperty();
  } else if (type.isEnum()) {
    return new StringProperty();
  }
  throw new IllegalArgumentException("invalid property type");
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:22,代码来源:SwaggerGenerator.java

示例4: registerErrorModel

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
/**
 * Manually register the Pippo Error class as  Swagger model.
 *
 * @param swagger
 * @return a ref for the Error model
 */
protected RefProperty registerErrorModel(Swagger swagger) {
    String ref = Error.class.getSimpleName();
    if (swagger.getDefinitions() != null && swagger.getDefinitions().containsKey(ref)) {
        // model already registered
        return new RefProperty(ref);
    }

    ModelImpl model = new ModelImpl();
    swagger.addDefinition(ref, model);

    model.setDescription("an error message");

    model.addProperty("statusCode", new IntegerProperty().readOnly().description("http status code"));
    model.addProperty("statusMessage", new StringProperty().readOnly().description("description of the http status code"));
    model.addProperty("requestMethod", new StringProperty().readOnly().description("http request method"));
    model.addProperty("requestUri", new StringProperty().readOnly().description("http request path"));
    model.addProperty("message", new StringProperty().readOnly().description("application message"));

    if (settings.isDev()) {
        // in DEV mode the stacktrace is returned in the error message
        model.addProperty("stacktrace", new StringProperty().readOnly().description("application stacktrace"));
    }

    return new RefProperty(ref);
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:32,代码来源:SwaggerBuilder.java

示例5: getItems

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
public static Property getItems(DataType dataType) {
	if (DataType.String.equals(dataType))
		return new StringProperty();
	else if (DataType.Integer.equals(dataType))
		return new IntegerProperty();
	else if (DataType.Boolean.equals(dataType))
		return new BooleanProperty();
	else if (DataType.Number.equals(dataType))
		return new DoubleProperty();
	return null;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:12,代码来源:SwaggerUtils.java

示例6: mapTupleValue_ThrowsException_WhenNoSupportingMapperFound

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void mapTupleValue_ThrowsException_WhenNoSupportingMapperFound() {
  // Arrange
  IntegerProperty schema = new IntegerProperty();
  when(stringSchemaMapper.supports(schema)).thenReturn(false);

  // Assert
  thrown.expect(SchemaMapperRuntimeException.class);
  thrown.expectMessage(
      String.format("No schema mapper available for '%s'.", schema.getClass().getName()));

  // Act
  schemaMapperAdapter.mapTupleValue(schema,
      ValueContext.builder().value(DBEERPEDIA.BROUWTOREN_NAME).build());
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:16,代码来源:SchemaMapperAdapterTest.java

示例7: supports_ReturnsTrue_ForNonStringProperty

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void supports_ReturnsTrue_ForNonStringProperty() {
  // Arrange & Act
  Boolean supported = mapper.supports(new IntegerProperty());

  // Assert
  assertThat(supported, equalTo(false));
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:9,代码来源:StringSchemaMapperTest.java

示例8: setUp

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Before
public void setUp() {
  schemaMapper = new IntegerSchemaMapper();
  property = new IntegerProperty();

  when(entityBuilderContext.getLdPathExecutor()).thenReturn(ldPathExecutor);
  schemaMapperAdapter = new SchemaMapperAdapter(Arrays.asList(schemaMapper));
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:9,代码来源:IntegerSchemaMapperTest.java

示例9: testSwaggerBasic

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void testSwaggerBasic(){
	
	SwaggerBuilder builder = new SwaggerBuilder();
	builder.withInfo().withTitle("Test Title").withVersion("1.0");
	
	ResponseBuilder responseBuilder = new ResponseBuilder();
	responseBuilder.withDescription("200 description");
	responseBuilder.withSchema(new RefPropertyBuilder().withReferenceTo("TestRef"));
	builder.withPath("/conclusion").withGet().withTags(Arrays.asList("Test")).withResponse("200", responseBuilder);

	ModelBuilder mBuilder = builder.withModelDefinition("TestRef");
	mBuilder.withReferencePropertyNamed("DefTestRef").withReferenceTo("some reference");
	mBuilder.withStringPropertyNamed("TestModelProperty").withExample("myexample").withFormat("myformat");
	mBuilder.withStringPropertyNamed("secondProperty").withExample("secondExample");
	
	IntegerProperty intProperty = new IntegerProperty();
	intProperty.example(10);
	intProperty.setDescription("IntegerTest");
	mBuilder.withArrayProperty("arrayProperty").withItems(intProperty);
	
	RefPropertyBuilder refBuilder = new RefPropertyBuilder().withReferenceTo("finalArrayRef");
	mBuilder.withArrayProperty("refArrayProperty").withItems(refBuilder.build());
	
	Swagger swagger = builder.build();
	Json.prettyPrint(swagger);
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:28,代码来源:TestSwaggerBuilders.java

示例10: getDefaultValue

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
public static String getDefaultValue(Property property){
    Validate.notNull(property, "property must not be null!");
    String defaultValue = "";
    if(property instanceof BooleanProperty){
        BooleanProperty booleanProperty = (BooleanProperty)property;
        defaultValue = Objects.toString(booleanProperty.getDefault(), "");
    }else if(property instanceof StringProperty){
        StringProperty stringProperty = (StringProperty)property;
        defaultValue = Objects.toString(stringProperty.getDefault(), "");
    }else if(property instanceof DoubleProperty){
        DoubleProperty doubleProperty = (DoubleProperty)property;
        defaultValue = Objects.toString(doubleProperty.getDefault(), "");
    }else if(property instanceof FloatProperty){
        FloatProperty floatProperty = (FloatProperty)property;
        defaultValue = Objects.toString(floatProperty.getDefault(), "");
    }else if(property instanceof IntegerProperty){
        IntegerProperty integerProperty = (IntegerProperty)property;
        defaultValue = Objects.toString(integerProperty.getDefault(), "");
    }
    else if(property instanceof LongProperty){
        LongProperty longProperty = (LongProperty)property;
        defaultValue = Objects.toString(longProperty.getDefault(), "");
    }
    else if(property instanceof UUIDProperty){
        UUIDProperty uuidProperty = (UUIDProperty)property;
        defaultValue = Objects.toString(uuidProperty.getDefault(), "");
    }
    return defaultValue;
}
 
开发者ID:buremba,项目名称:swagger-slate,代码行数:30,代码来源:PropertyUtils.java

示例11: validate_withTooFewValues_shouldFail_whenMinItemsSpecified

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void validate_withTooFewValues_shouldFail_whenMinItemsSpecified() {
    Status status = classUnderTest.validate("1,2", arrayParam(true, "csv", 3, 5, null, new IntegerProperty()));
    Assert.assertNotNull(status);
    Assert.assertEquals("ERR11007", status.getCode()); // request parameter collection too few items
}
 
开发者ID:networknt,项目名称:light-rest-4j,代码行数:7,代码来源:ArrayParameterValidatorTest.java

示例12: validate_withTooManyValues_shouldFail_whenMaxItemsSpecified

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void validate_withTooManyValues_shouldFail_whenMaxItemsSpecified() {
    Status status = classUnderTest.validate("1,2,3,4,5,6", arrayParam(true, "csv", 3, 5, null, new IntegerProperty()));
    Assert.assertNotNull(status);
    Assert.assertEquals("ERR11006", status.getCode()); // request parameter collection too many items
}
 
开发者ID:networknt,项目名称:light-rest-4j,代码行数:7,代码来源:ArrayParameterValidatorTest.java

示例13: validate_withNonUniqueValues_shouldFail_whenUniqueSpecified

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void validate_withNonUniqueValues_shouldFail_whenUniqueSpecified() {
    Status status = classUnderTest.validate("1,2,1", arrayParam(true, "csv", null, null, true, new IntegerProperty()));
    Assert.assertNotNull(status);
    Assert.assertEquals("ERR11008", status.getCode()); // request parameter collection duplicate items
}
 
开发者ID:networknt,项目名称:light-rest-4j,代码行数:7,代码来源:ArrayParameterValidatorTest.java

示例14: validate_withNonUniqueValues_shouldPass_whenUniqueNotSpecified

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void validate_withNonUniqueValues_shouldPass_whenUniqueNotSpecified() {
    Assert.assertNull(classUnderTest.validate("1,2,1", arrayParam(true, "csv", null, null, false, new IntegerProperty())));
}
 
开发者ID:networknt,项目名称:light-rest-4j,代码行数:5,代码来源:ArrayParameterValidatorTest.java

示例15: validate_withEnumValues_shouldPass_whenAllValuesMatchEnum

import io.swagger.models.properties.IntegerProperty; //导入依赖的package包/类
@Test
public void validate_withEnumValues_shouldPass_whenAllValuesMatchEnum() {
    Assert.assertNull(classUnderTest.validate("1,2,1", enumeratedArrayParam(true, "csv", new IntegerProperty(), "1", "2", "3")));
}
 
开发者ID:networknt,项目名称:light-rest-4j,代码行数:5,代码来源:ArrayParameterValidatorTest.java


注:本文中的io.swagger.models.properties.IntegerProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。