Testi.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:test-html-generator-plugin 作者:
public static void main(String[] args) throws JsonMappingException {
    ObjectMapper jsonMapper = new ObjectMapper();
    AnnotationIntrospector introspector = new AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(), 
            new JacksonAnnotationIntrospector());
    jsonMapper.setAnnotationIntrospector(introspector);
    JsonSchema schema = jsonMapper.generateJsonSchema(Testi.class);
    if(Testi.class.getAnnotation(XmlRootElement.class)!=null
            && !Testi.class.getAnnotation(XmlRootElement.class).name().equals("##default"))
        schema.getSchemaNode().put("name", Testi.class.getAnnotation(XmlRootElement.class).name());
    else if(Testi.class.getAnnotation(XmlType.class)!=null
            && !Testi.class.getAnnotation(XmlType.class).name().equals("##default"))
        schema.getSchemaNode().put("name", Testi.class.getAnnotation(XmlType.class).name());
    else
        schema.getSchemaNode().put("name", Testi.class.getSimpleName());
    String schemaJson = schema.toString();
    System.out.println(schemaJson);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号