• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ModelConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(JavaType propType, ModelConverterContext context, Annotation[] annotations,
    Iterator<ModelConverter> next) {
  checkType(propType);

  PropertyCreator creator = propertyCreatorMap.get(propType.getRawClass());
  if (creator != null) {
    return creator.createProperty();
  }

  Property property = super.resolveProperty(propType, context, annotations, next);
  if (StringProperty.class.isInstance(property)) {
    if (StringPropertyConverter.isEnum((StringProperty) property)) {
      setType(propType, property.getVendorExtensions());
    }
  }
  return property;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:ModelResolverExt.java


示例2: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations, Iterator<ModelConverter> chain) {
    final JavaType jType = Json.mapper().constructType(type);
    if (jType != null) {
        final Class<?> cls = jType.getRawClass();
        if (cls.equals(ObjectId.class)) {
            StringProperty property = new StringProperty();
            property.setExample("588f7ee98f138b19220041a7");
            return property;
        }
    }
    if (chain.hasNext()) {
        return chain.next().resolveProperty(type, context, annotations, chain);
    } else {
        return null;
    }
}
 
开发者ID:stardogventures,项目名称:starwizard,代码行数:18,代码来源:ObjectIdConverter.java


示例3: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override public Property resolveProperty(Type type, ModelConverterContext context,
    Annotation[] annotations, Iterator<ModelConverter> chain) {
  try {
    TypeLiteral<?> typeLiteral = TypeLiteral.get(type);
    String typeName = typeLiteral.getType().getTypeName();
    if (typeName.equals("java.util.List<org.jooby.Upload>") ||
        typeName.equals("java.util.Set<org.jooby.Upload>")) {
      return new ArrayProperty(new FileProperty());
    }
    if (typeName.equals(Upload.class.getName())) {
      return new FileProperty();
    }
    return super.resolveProperty(type, context, annotations, chain);
  } catch (IllegalArgumentException x) {
    // shhh
    return super.resolveProperty(type, context, annotations, chain);
  }
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:19,代码来源:SwaggerBuilder.java


示例4: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(JavaType type, ModelConverterContext context, Iterator<ModelConverter> next) {
  // property is not a model
  if (propertyCreatorMap.containsKey(type.getRawClass())) {
    return null;
  }

  Model model = super.resolve(type, context, next);
  if (model == null) {
    return null;
  }

  checkType(type);

  // 只有声明model的地方才需要标注类型
  if (ModelImpl.class.isInstance(model) && !StringUtils.isEmpty(((ModelImpl) model).getName())) {
    setType(type, model.getVendorExtensions());
  }
  return model;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:21,代码来源:ModelResolverExt.java


示例5: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(Type type, ModelConverterContext context, Iterator<ModelConverter> chain) {

	// skip PropertyBox types
	if (PropertyBoxTypeInfo.check(type).isPresent()) {
		return null;
	}

	if (chain.hasNext()) {
		return chain.next().resolve(type, context, chain);
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:14,代码来源:PropertyBoxModelConverter.java


示例6: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(Type type, ModelConverterContext context, Iterator<ModelConverter> chain) {
    if (chain.hasNext()) {
        return chain.next().resolve(type, context, chain);
    } else  {
        return null;
    }
}
 
开发者ID:stardogventures,项目名称:starwizard,代码行数:9,代码来源:ObjectIdConverter.java


示例7: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Test
public void resolveProperty() throws Exception {
    ObjectIdConverter converter = new ObjectIdConverter();

    List<ModelConverter> others = new ArrayList<>();
    Annotation[] annotations = new Annotation[]{};
    Property property = converter.resolveProperty(ObjectId.class, null, annotations, others.iterator());
    assertTrue(property instanceof StringProperty);
    assertEquals("588f7ee98f138b19220041a7", property.getExample());
}
 
开发者ID:stardogventures,项目名称:starwizard,代码行数:11,代码来源:ObjectIdConverterTest.java


示例8: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(final Type type,
                     final ModelConverterContext context,
                     final Iterator<ModelConverter> chain)
{
  if (!BANNED_TYPE_NAMES.contains(type.getTypeName()) && chain.hasNext()) {
    return chain.next().resolve(type, context, chain);
  }
  return null;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:11,代码来源:SwaggerModel.java


示例9: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(final Type type,
                                final ModelConverterContext context,
                                final Annotation[] annotations,
                                final Iterator<ModelConverter> chain)
{
  if (!BANNED_TYPE_NAMES.contains(type.getTypeName()) && chain.hasNext()) {
    return chain.next().resolveProperty(type, context, annotations, chain);
  }
  return null;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:12,代码来源:SwaggerModel.java


示例10: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations,
                                Iterator<ModelConverter> chain) {
    if (type instanceof Class<?>) {
        Class<?> cls = (Class<?>) type;
        if (paramClass.isAssignableFrom(cls)) {
            return propertySupplier.get();
        }
    }
    if (chain.hasNext()) {
        return chain.next().resolveProperty(type, context, annotations, chain);
    } else {
        return null;
    }
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:16,代码来源:SwaggerFilter.java


示例11: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(Type type, ModelConverterContext context, Iterator<ModelConverter> chain) {
    if (chain.hasNext()) {
        return chain.next().resolve(type, context, chain);
    } else {
        return null;
    }
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:9,代码来源:SwaggerFilter.java


示例12: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations, Iterator<ModelConverter> chain) {
	// for method parameter types we get here Type but we need JavaType
	JavaType javaType = toJavaType(type);
    if (modelSubtitutes.containsKey(javaType)) {
        return super.resolveProperty(modelSubtitutes.get(javaType), context, annotations, chain);
    } else if (chain.hasNext()) {
        return chain.next().resolveProperty(type, context, annotations, chain);
    } else {
        return super.resolveProperty(type, context, annotations, chain);
    }

}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:14,代码来源:ModelModifier.java


示例13: resolve

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Model resolve(Type type, ModelConverterContext context, Iterator<ModelConverter> chain) {
	// for method parameter types we get here Type but we need JavaType
	JavaType javaType = toJavaType(type);
    if (modelSubtitutes.containsKey(javaType)) {
        return super.resolve(modelSubtitutes.get(javaType), context, chain);
    } else {
        return super.resolve(type, context, chain);
    }
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:11,代码来源:ModelModifier.java


示例14: resolveProperty

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
@Override
public Property resolveProperty(Type type, ModelConverterContext modelConverterContext, Annotation[] annotations, Iterator<ModelConverter> iterator) {
    try {
        Type expectedType = _mapper.constructType(Class.forName("com.wordnik.sample.model.PetId"));
        if (type.equals(expectedType)) {
            return super.resolveProperty(_mapper.constructType(Class.forName("java.lang.String")), modelConverterContext, annotations, iterator);
        }
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
    return super.resolveProperty(type, modelConverterContext, annotations, iterator);
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:13,代码来源:PetIdToStringModelConverter.java


示例15: addConverter

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
public void addConverter(ModelConverter converter) {
    converters.add(0, converter);
}
 
开发者ID:buremba,项目名称:netty-rest,代码行数:4,代码来源:ModelConverters.java


示例16: removeConverter

import io.swagger.converter.ModelConverter; //导入依赖的package包/类
public void removeConverter(ModelConverter converter) {
    converters.remove(converter);
}
 
开发者ID:buremba,项目名称:netty-rest,代码行数:4,代码来源:ModelConverters.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AudioPlayer类代码示例发布时间:2022-05-22
下一篇:
Java DeleteBlockPoolRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap