private static Set < Key > processSpec ( boolean parentIsArray , Map < String , Object > spec ) { // TODO switch to List<Key> and sort before returning Set < Key > result = new HashSet <> ( ) ; for ( String key : spec . keySet ( ) ) { Object subSpec = spec . get ( key ) ; if ( parentIsArray ) { result . add ( new ArrayKey ( key , subSpec ) ) ; // this will recursively call processSpec if needed } else { result . add ( new MapKey ( key , subSpec ) ) ; // this will recursively call processSpec if needed } } return result ; }
Recursively walk the spec input tree . Handle arrays by telling DefaultrKeys if they need to be ArrayKeys and to find the max default array length .