private static Object generateExampleForRefModel ( boolean generateMissingExamples , String simpleRef , Map < String , Model > definitions , DocumentResolver definitionDocumentResolver , MarkupDocBuilder markupDocBuilder , Map < String , Integer > refStack ) { Model model = definitions . get ( simpleRef ) ; Object example = null ; if ( model != null ) { example = model . getExample ( ) ; if ( example == null && generateMissingExamples ) { if ( ! refStack . containsKey ( simpleRef ) ) { refStack . put ( simpleRef , 1 ) ; } else { refStack . put ( simpleRef , refStack . get ( simpleRef ) + 1 ) ; } if ( refStack . get ( simpleRef ) <= MAX_RECURSION_TO_DISPLAY ) { if ( model instanceof ComposedModel ) { //FIXME: getProperties() may throw NullPointerException example = exampleMapForProperties ( ( ( ObjectType ) ModelUtils . getType ( model , definitions , definitionDocumentResolver ) ) . getProperties ( ) , definitions , definitionDocumentResolver , markupDocBuilder , new HashMap <> ( ) ) ; } else { example = exampleMapForProperties ( model . getProperties ( ) , definitions , definitionDocumentResolver , markupDocBuilder , refStack ) ; } } else { return "..." ; } refStack . put ( simpleRef , refStack . get ( simpleRef ) - 1 ) ; } } return example ; }
Generates an example object from a simple reference