private < T > T newInstance ( DatastoreId id , DatastoreType datastoreType , DynamicType < ? > types , TransactionalCache . Mode cacheMode ) { validateType ( types ) ; InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler ( datastoreType , getProxyMethodService ( ) ) ; T instance = proxyFactory . createInstance ( invocationHandler , types . getCompositeType ( ) ) ; cache . put ( id , instance , cacheMode ) ; return instance ; }
Create a proxy instance which corresponds to the given datastore type .