Examples of acceptJsonFormatVisitor()


Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

    public void testJsonValueAnnotation() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(mapper.constructType(Leaf.class), visitor);
        JsonSchema schemaExp = visitor.finalSchema();
        assertNotNull(schemaExp);
       
        visitor = new SchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(mapper.constructType(ContainerWithAsValue.class), visitor);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

        mapper.acceptJsonFormatVisitor(mapper.constructType(Leaf.class), visitor);
        JsonSchema schemaExp = visitor.finalSchema();
        assertNotNull(schemaExp);
       
        visitor = new SchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(mapper.constructType(ContainerWithAsValue.class), visitor);
        JsonSchema schemaAct = visitor.finalSchema();
        assertNotNull(schemaAct);

        // these are minimal checks:
        assertEquals(schemaExp.getType(), schemaAct.getType());
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

    public void testJsonValueForCollection() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(mapper.constructType(Issue34Bean.class), visitor);
        JsonSchema schema = visitor.finalSchema();
        assertNotNull(schema);
       
        String schemaStr = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);
        assertNotNull(schemaStr);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

    public void testSimpleHyperWithDefaultSchema() throws Exception {
        HyperSchemaFactoryWrapper personVisitor = new HyperSchemaFactoryWrapper();
        personVisitor.setIgnoreDefaults(false);
        ObjectMapper mapper = new ObjectMapper();

        mapper.acceptJsonFormatVisitor(Person.class, personVisitor);
        JsonSchema personSchema = personVisitor.finalSchema();

        HyperSchemaFactoryWrapper petVisitor = new HyperSchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(Pet.class, petVisitor);
        JsonSchema petSchema = petVisitor.finalSchema();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

        mapper.acceptJsonFormatVisitor(Person.class, personVisitor);
        JsonSchema personSchema = personVisitor.finalSchema();

        HyperSchemaFactoryWrapper petVisitor = new HyperSchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(Pet.class, petVisitor);
        JsonSchema petSchema = petVisitor.finalSchema();

        assertTrue("schema should be an objectSchema.", personSchema.isObjectSchema());
        LinkDescriptionObject[] links = personSchema.asObjectSchema().getLinks();
        assertNotNull(links);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

    public void testSimpleHyperWithoutDefaultSchema() throws Exception {
        HyperSchemaFactoryWrapper personVisitor = new HyperSchemaFactoryWrapper();
        ObjectMapper mapper = new ObjectMapper();

        mapper.acceptJsonFormatVisitor(Person.class, personVisitor);
        JsonSchema personSchema = personVisitor.finalSchema();

        HyperSchemaFactoryWrapper petVisitor = new HyperSchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(Pet.class, petVisitor);
        JsonSchema petSchema = petVisitor.finalSchema();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

        mapper.acceptJsonFormatVisitor(Person.class, personVisitor);
        JsonSchema personSchema = personVisitor.finalSchema();

        HyperSchemaFactoryWrapper petVisitor = new HyperSchemaFactoryWrapper();
        mapper.acceptJsonFormatVisitor(Pet.class, petVisitor);
        JsonSchema petSchema = petVisitor.finalSchema();

        assertTrue("schema should be an objectSchema.", personSchema.isObjectSchema());
        LinkDescriptionObject[] links = personSchema.asObjectSchema().getLinks();
        assertNotNull(links);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

  public void testAddingTitle() throws Exception
  {
    TitleSchemaFactoryWrapper visitor = new TitleSchemaFactoryWrapper();
    ObjectMapper mapper = new ObjectMapper();

    mapper.acceptJsonFormatVisitor(Person.class, visitor);
    JsonSchema schema = visitor.finalSchema();

    assertTrue("schema should be an objectSchema.", schema.isObjectSchema());
    String title = schema.asObjectSchema().getTitle();
    assertNotNull(title);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()


        ObjectMapper mapper = new ObjectMapper();
        SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
        try {
            mapper.acceptJsonFormatVisitor(clazz, visitor);

            JsonSchema schema = visitor.finalSchema();
            return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);

        } catch (JsonMappingException e) {
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.acceptJsonFormatVisitor()

                } else {

                    ObjectMapper objectMapper = new ObjectMapper();
                    SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
                    objectMapper.acceptJsonFormatVisitor(objectClass, visitor);
                    JsonSchema schema = visitor.finalSchema();
                    schemaDef = objectMapper.writeValueAsString(schema);
                    schemaMap.put(objectClass, schemaDef);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.