private Object getOrMakeSerializedObject ( Object entityEntryValue , Map < Object , Map < String , Object > > serializedCache ) { if ( serializedCache . containsKey ( entityEntryValue ) ) //cyclic relation { //take from cache and substitute return serializedCache . get ( entityEntryValue ) ; } else //not cyclic relation { //serialize and put into result return serializeToMap ( entityEntryValue , serializedCache ) ; } }
Returns serialized object from cache or serializes object if it s not present in cache .