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


Java BooleanProperty类代码示例

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


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

示例1: initPropertyMap

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

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

示例3: makeProperty

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

示例4: setResponseType

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
private void setResponseType(Response response, String type) {
    try {
        Class<?> clazz;
        switch (type) {
        case "int":
        case "long":
        case "short":
        case "byte":
        case "double":
        case "float":
            clazz = Double.class;
            break;
        case "char":
            clazz = Character.class;
            break;
        case "boolean":
            clazz = Boolean.class;
            break;
        default:
            clazz = Class.forName(type);
        }

        if (clazz == Object.class || clazz == JsonObject.class) {
            // a generic JSON
            response.setSchema(new ObjectProperty());
        } else if (Number.class.isAssignableFrom(clazz)) {
            response.setSchema(new DoubleProperty());
        } else if (clazz == Boolean.class) {
            response.setSchema(new BooleanProperty());
        } else if (clazz == String.class || clazz == Character.class) {
            response.setSchema(new StringProperty());
        } else if (clazz != Void.class) {
            response.setSchema(refProperty(modelForPodo(clazz)));
        }
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(SwaggerAssembler.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:39,代码来源:SwaggerAssembler.java

示例5: getItems

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

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

示例7: mapTupleValue

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
@Override
public Boolean mapTupleValue(@NonNull BooleanProperty schema,
    @NonNull ValueContext valueContext) {
  return SchemaMapperUtils.castLiteralValue(valueContext.getValue()).booleanValue();
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:6,代码来源:BooleanSchemaMapper.java

示例8: mapGraphValue

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
@Override
public Boolean mapGraphValue(@NonNull BooleanProperty schema,
    @NonNull GraphEntityContext graphEntityContext, @NonNull ValueContext valueContext,
    @NonNull SchemaMapperAdapter schemaMapperAdapter) {
  return SchemaMapperUtils.castLiteralValue(valueContext.getValue()).booleanValue();
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:7,代码来源:BooleanSchemaMapper.java

示例9: supports

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
@Override
public boolean supports(@NonNull Property schema) {
  return schema instanceof BooleanProperty;
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:5,代码来源:BooleanSchemaMapper.java

示例10: setUp

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
@Before
public void setUp() {
  schemaMapper = new BooleanSchemaMapper();
  schema = new BooleanProperty();
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:6,代码来源:BooleanSchemaMapperTest.java

示例11: build

import io.swagger.models.properties.BooleanProperty; //导入依赖的package包/类
public Property build() {
	BooleanProperty property = new BooleanProperty();
	property.setFormat(format);
	property.setExample(example);
	return property;
}
 
开发者ID:pegasystems,项目名称:api2swagger,代码行数:7,代码来源:BooleanPropertyBuilder.java


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