private static Map < String , Object > exampleMapForProperties ( Map < String , Property > properties , Map < String , Model > definitions , DocumentResolver definitionDocumentResolver , MarkupDocBuilder markupDocBuilder , Map < String , Integer > refStack ) { Map < String , Object > exampleMap = new LinkedHashMap <> ( ) ; if ( properties != null ) { for ( Map . Entry < String , Property > property : properties . entrySet ( ) ) { Object exampleObject = property . getValue ( ) . getExample ( ) ; if ( exampleObject == null ) { if ( property . getValue ( ) instanceof RefProperty ) { exampleObject = generateExampleForRefModel ( true , ( ( RefProperty ) property . getValue ( ) ) . getSimpleRef ( ) , definitions , definitionDocumentResolver , markupDocBuilder , refStack ) ; } else if ( property . getValue ( ) instanceof ArrayProperty ) { exampleObject = generateExampleForArrayProperty ( ( ArrayProperty ) property . getValue ( ) , definitions , definitionDocumentResolver , markupDocBuilder , refStack ) ; } else if ( property . getValue ( ) instanceof MapProperty ) { exampleObject = generateExampleForMapProperty ( ( MapProperty ) property . getValue ( ) , markupDocBuilder ) ; } if ( exampleObject == null ) { Property valueProperty = property . getValue ( ) ; exampleObject = PropertyAdapter . generateExample ( valueProperty , markupDocBuilder ) ; } } exampleMap . put ( property . getKey ( ) , exampleObject ) ; } } return exampleMap ; }
Generates a map of examples from a map of properties . If defined examples are found those are used . Otherwise examples are generated from the type .