class ScopeGuard implements IScopeGuard {

    public void close() throws ScopeGuardException {
        try {
            if (previousScope != null) {
                ScopeProvider.setCurrentScope(previousScope);
            } else {
                throw new Exception();
            }
        } catch (Exception e) {
            throw new ScopeGuardException("ScopeGuard could not restore original state.", e);
        }
    }

    public  ScopeGuard(final Object key);

}