Package org.codehaus.jackson.schema

Examples of org.codehaus.jackson.schema.JsonSchema


     * @since 1.7
     */
    public void testWithJaxb() throws Exception
    {
        ObjectMapper mapper = getJaxbMapper();
        JsonSchema jsonSchema = mapper.generateJsonSchema(Address.class);
        ObjectNode root = jsonSchema.getSchemaNode();
        // should find two properties ("city", "state"), not just one...
        JsonNode itemsNode = root.findValue("properties");
        assertNotNull("Missing 'state' field", itemsNode.get("state"));
        assertNotNull("Missing 'city' field", itemsNode.get("city"));
        assertEquals(2, itemsNode.size());
View Full Code Here


        if (!(schemaNode instanceof ObjectNode)) {
            throw new IllegalArgumentException("Class " + type.getName() +
                    " would not be serialized as a JSON object and therefore has no schema");
        }

        return new JsonSchema((ObjectNode) schemaNode);
    }
View Full Code Here

    columnFamily2.setRows(rows2);
    columnFamilies.add(columnFamily2);

    ObjectMapper jSONMapper = new ObjectMapper();
    try {
      JsonSchema schema = jSONMapper.generateJsonSchema(ParsedKeyspace.class);
      log.debug(schema.toString());
      log.debug(jSONMapper.writeValueAsString(keyspace));
    } catch (JsonMappingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (JsonGenerationException e) {
View Full Code Here

        if (!(schemaNode instanceof ObjectNode)) {
            throw new IllegalArgumentException("Class " + type.getName() +
                    " would not be serialized as a JSON object and therefore has no schema");
        }

        return new JsonSchema((ObjectNode) schemaNode);
    }
View Full Code Here

        if (!(schemaNode instanceof ObjectNode)) {
            throw new IllegalArgumentException("Class " + type.getName() +
                    " would not be serialized as a JSON object and therefore has no schema.");
        }

        return new JsonSchema((ObjectNode) schemaNode);
    }
View Full Code Here

        if (!(schemaNode instanceof ObjectNode)) {
            throw new IllegalArgumentException("Class " + type.getName() +
                    " would not be serialized as a JSON object and therefore has no schema.");
        }

        return new JsonSchema((ObjectNode) schemaNode);
    }
View Full Code Here

            for (Iterator<Class> it = classSet.iterator(); it.hasNext();) {
                Class next = it.next();

                try {

                    JsonSchema schema = mapper.generateJsonSchema(next);
                    String jsonName = derriveName(next);
                    ObjectNode schemaNode = schema.getSchemaNode();
                    schemaNode.put("name", jsonName);
                   
                    CharArrayWriter writer = new CharArrayWriter();
                    mapper.writeTree(mapper.getJsonFactory().createJsonGenerator(writer), schemaNode);
                   
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.schema.JsonSchema

Copyright © 2018 www.massapicom. 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.