private String buildString ( ) { if ( type . isSimpleType ( ) ) { return ' ' + type . name ( ) . toLowerCase ( ) + ' ' ; } StringBuilder builder = new StringBuilder ( ) ; JsonWriter writer = new JsonWriter ( CharStreams . asWriter ( builder ) ) ; try { new SchemaTypeAdapter ( ) . write ( writer , this ) ; writer . close ( ) ; return builder . toString ( ) ; } catch ( IOException e ) { // It should never throw IOException on the StringBuilder Writer, if it does, something very wrong. throw Throwables . propagate ( e ) ; } }
Helper method to encode this schema into json string .