@ NonNull @ Contract ( pure = true ) private < Output > ChronosOperationResult < Output > createEmptyResult ( @ NonNull final ChronosOperation < Output > operation , final boolean broadcastResult ) { final ChronosOperationResult < Output > operationResult ; final Class < ? extends ChronosOperationResult < Output > > resultClass = operation . getResultClass ( ) ; try { operationResult = resultClass . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( "Can't create a new instance of " + resultClass . getName ( ) ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( resultClass . getName ( ) + " constructor is not accessible" ) ; } operationResult . setId ( mLastOperationId . incrementAndGet ( ) ) ; operationResult . setOperation ( operation ) ; operationResult . setBroadcast ( broadcastResult ) ; return operationResult ; }
Creates a template object for storing operations run result .