本文整理汇总了Java中io.swagger.models.ModelImpl.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java ModelImpl.getProperties方法的具体用法?Java ModelImpl.getProperties怎么用?Java ModelImpl.getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.ModelImpl
的用法示例。
在下文中一共展示了ModelImpl.getProperties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFields
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
/**
* Returns list of {@link com.google.protobuf.Field.Builder} created using the properties of a
* {@link ModelImpl} object.
*/
private ImmutableList.Builder<Field> createFields(
Service.Builder serviceBuilder, ModelImpl modelImpl) {
ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder();
int count = 1;
if (modelImpl.getProperties() != null) {
for (String propertyName : modelImpl.getProperties().keySet()) {
Property prop = modelImpl.getProperties().get(propertyName);
TypeInfo typeInfo =
ensureNamed(
serviceBuilder,
getTypeInfo(serviceBuilder, prop),
NameConverter.propertyNameToMessageName(propertyName));
fieldsBuilder.add(createField(propertyName, count++, typeInfo).build());
}
}
return fieldsBuilder;
}
示例2: doConvert
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
@Override
public JavaType doConvert(ClassLoader classLoader, String packageName, Swagger swagger, Object model) {
ModelImpl modelImpl = (ModelImpl) model;
JavaType javaType = ConverterMgr.findJavaType(modelImpl.getType(), modelImpl.getFormat());
if (javaType != null) {
return javaType;
}
if (modelImpl.getReference() != null) {
return ConverterMgr.findByRef(classLoader, packageName, swagger, modelImpl.getReference());
}
if (modelImpl.getAdditionalProperties() != null) {
return MapPropertyConverter.findJavaType(classLoader,
packageName,
swagger,
modelImpl.getAdditionalProperties());
}
if (ObjectProperty.TYPE.equals(modelImpl.getType())
&& modelImpl.getProperties() == null
&& modelImpl.getName() == null) {
return TypeFactory.defaultInstance().constructType(Object.class);
}
// 根据name、property动态生成class
if (packageName == null) {
throw new Error("packageName should not be null");
}
String clsName = packageName + "." + modelImpl.getName();
Class<?> cls =
ClassUtils.getOrCreateClass(classLoader, packageName, swagger, modelImpl.getProperties(), clsName);
return TypeFactory.defaultInstance().constructType(cls);
}
示例3: isPrimitiveTypeWrapper
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
/**
* Returns true if the modelImpl is a wrapper of primitive type like string, Float etc; false
* otherwise
*/
private boolean isPrimitiveTypeWrapper(ModelImpl modelImpl) {
return (modelImpl.getProperties() == null && modelImpl.getAdditionalProperties() == null)
&& !Strings.isNullOrEmpty(modelImpl.getType())
&& !"object".equalsIgnoreCase(modelImpl.getType())
&& WellKnownTypeUtils.isPrimitiveType(modelImpl.getType());
}
示例4: hasProperties
import io.swagger.models.ModelImpl; //导入方法依赖的package包/类
/** Returns true if the modelImpl has properties. */
private boolean hasProperties(ModelImpl modelImpl) {
return modelImpl.getProperties() != null;
}